function wsl_component_buddypress_sidebar_what_is_this()
{
    ?>
<div class="postbox">
	<div class="inside">
		<h3><?php 
    _wsl_e("BuddyPress integration", 'wordpress-social-login');
    ?>
</h3>

		<div style="padding:0 20px;">
			<p>
				<?php 
    _wsl_e('WSL can be now fully integrated with your <a href="https://buddypress.org" target="_blank">BuddyPress</a> installation. When enabled, user avatars display should work right out of the box with most WordPress themes and your BuddyPress installation', 'wordpress-social-login');
    ?>
.
			</p> 

			<p>
				<?php 
    _wsl_e('WSL also comes with BuddyPress xProfiles mappings. When this feature is enabled, WSL will try to automatically fill in Buddypress users profiles from their social networks profiles', 'wordpress-social-login');
    ?>
.
			</p> 
		</div>
	</div>
</div>
<?php 
}
function wsl_component_tools_sidebar_what_is_this()
{
    ?>
<div class="postbox">
	<div class="inside">
		<h3><?php 
    _wsl_e("WordPress Social Login Tools", 'wordpress-social-login');
    ?>
</h3>

		<div style="padding:0 20px;">
			<p>
				<?php 
    _wsl_e('Here you can found a set of tools to help you find and hopefully fix any issue you may encounter', 'wordpress-social-login');
    ?>
.
			</p>
			<p>
				<?php 
    _wsl_e('You can also delete all Wordpress Social Login tables and stored options from the <b>Uninstall</b> section down below', 'wordpress-social-login');
    ?>
.
			</p>
		</div> 
	</div>
</div>
<?php 
}
function wsl_component_help_sidebar()
{
    // HOOKABLE:
    do_action("wsl_component_help_sidebar_start");
    ?>
<div class="postbox">
	<div class="inside">
		<h3><?php 
    _wsl_e("About WordPress Social Login", 'wordpress-social-login');
    ?>
 <?php 
    echo wsl_get_version();
    ?>
</h3>

		<div style="padding:0 20px;">
			<p>
				<?php 
    _wsl_e('WordPress Social Login is a free and open source plugin made by the community, for the community', 'wordpress-social-login');
    ?>
.
			</p> 
			<p>
				<?php 
    _wsl_e('Basically, WordPress Social Login allow your website visitors and customers to register and login via social networks such as twitter, facebook and google but it has much more to offer', 'wordpress-social-login');
    ?>
.
			</p> 
			<p>
				<?php 
    _wsl_e('For more information about WordPress Social Login, refer to our online user guide', 'wordpress-social-login');
    ?>
.
			</p> 
		</div> 
	</div> 
</div> 
<div class="postbox">
	<div class="inside">
		<h3><?php 
    _wsl_e("Thanks", 'wordpress-social-login');
    ?>
</h3>

		<div style="padding:0 20px;">
			<p>
				<?php 
    _wsl_e('Big thanks to everyone who have contributed to WordPress Social Login by submitting Patches, Ideas, Reviews and by Helping in the support forum', 'wordpress-social-login');
    ?>
.
			</p> 
		</div> 
	</div> 
</div>
<?php 
    // HOOKABLE:
    do_action("wsl_component_help_sidebar_end");
}
function wsl_component_networks_addmore()
{
    // HOOKABLE:
    do_action("wsl_component_networks_addmore_start");
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
    ?>
<table width="100%" border="0"> 
  <tr> 
    <td align="left">
		<p><?php 
    _wsl_e("And you could add even more of them, <b>Just Click</b> and we will guide you through", 'wordpress-social-login');
    ?>
 :</p>
		<?php 
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/32x32/icondock/';
    $nb_used = count($WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG);
    foreach ($WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG as $item) {
        $provider_id = @$item["provider_id"];
        $provider_name = @$item["provider_name"];
        $provider_cat = @$item["cat"];
        if (isset($item["default_network"]) && $item["default_network"]) {
            continue;
        }
        if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
            ?>
						<a href="options-general.php?page=wordpress-social-login&wslp=networks&enable=<?php 
            echo $provider_id;
            ?>
#setup<?php 
            echo strtolower($provider_id);
            ?>
"><img src="<?php 
            echo $assets_base_url . strtolower($provider_id) . '.png';
            ?>
" alt="<?php 
            echo $provider_name;
            ?>
" title="<?php 
            echo $provider_name;
            ?>
" /></a>
					<?php 
            $nb_used--;
        }
    }
    if ($nb_used == count($WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG)) {
        _wsl_e("Well! none left.", 'wordpress-social-login');
    }
    ?>
 
	</td>
  </tr> 
</table>
<?php 
    // HOOKABLE:
    do_action("wsl_component_networks_addmore_end");
}
function wsl_component_contacts_settings_sidebar_what_is_this()
{
    ?>
<div class="postbox">
	<div class="inside">
		<h3><?php 
    _wsl_e("User contacts import", 'wordpress-social-login');
    ?>
</h3>

		<div style="padding:0 20px;">
			<p>
				<?php 
    _wsl_e('WordPress Social Login also allow you to import users contact list from Google Gmail, Facebook, Windows Live, LinkedIn  and Vkontakte', 'wordpress-social-login');
    ?>
.
			</p> 

			<p>
				<?php 
    _wsl_e('When enabled, users authenticating through WordPress Social Login will be asked for the authorisation to import their contact list. Note that some social networks do not provide certain of their users information like contacts emails, photos and or profile urls', 'wordpress-social-login');
    ?>
.
			</p> 
			<hr />
			<p>
				<b><?php 
    _wsl_e("Notes", 'wordpress-social-login');
    ?>
:</b> 
			</p> 
			
			<ul style="margin-left:15px;margin-top:0px;">
				<li><?php 
    _wsl_e('To enable contacts import from these social network, you need first to enabled them on the <a href="options-general.php?page=wordpress-social-login&wslp=networks"><b>Networks</b></a> tab and register the required application', 'wordpress-social-login');
    ?>
.</li> 
				<li><?php 
    _wsl_e("<b>WSL</b> will try to import as much information about a user contacts as he was able to pull from the social networks APIs.", 'wordpress-social-login');
    ?>
</li> 
				<li><?php 
    _wsl_e('All contacts data are sotred into your database on the table: <code>`wsluserscontacts`</code>', 'wordpress-social-login');
    ?>
.</li> 
			</ul> 
		</div> 
	</div>
</div>
<?php 
}
function wsl_component_bouncer_sidebar_what_is_this()
{
    ?>
<div class="postbox">
	<div class="inside">
		<h3><?php 
    _wsl_e("What's This?", 'wordpress-social-login');
    ?>
</h3>

		<div style="padding:0 20px;">
			<h4 style="cursor: default;border-bottom:1px solid #ccc;font-size: 13px;"><?php 
    _wsl_e("Hey, meet our friend, the Bouncer", 'wordpress-social-login');
    ?>
</h4>

			<p style="margin:10px;font-size: 13px;">
			<?php 
    _wsl_e('Ever been in trouble with one of <a href="http://www.flickr.com/search/?q=bouncer+doorman&z=e" target="_blank">these guys</a>? Well, this module have more or less the same role, and he will try his best to piss your users off until they meet your requirements.', 'wordpress-social-login');
    ?>
			</p>

			<p style="margin:10px;font-size: 13px;">
			<?php 
    _wsl_e("This feature is most suited for small businesses and folks running a closed-door blog between friends or coworkers.", 'wordpress-social-login');
    ?>
			</p>

			<h4 style="cursor: default;border-bottom:1px solid #ccc;"><?php 
    _wsl_e("IMPORTANT!", 'wordpress-social-login');
    ?>
</h4>

			<p style="margin:10px;">
				<?php 
    _wsl_e("All the settings on this page without exception are only valid for users authenticating through <b>WordPress Social Login Widget", 'wordpress-social-login');
    ?>
</b>.
			</p> 
			<p style="margin:10px;">
			<?php 
    _wsl_e("Users authenticating through the regulars Wordpress Login and Register pages with their usernames and passwords WILL NOT be affected.", 'wordpress-social-login');
    ?>
			</p>
		</div> 
	</div> 
</div> 
<?php 
}
function wsl_component_networks_whyhello()
{
    // HOOKABLE:
    do_action("wsl_component_networks_whyhello_start");
    ?>
<div class="postbox " id="linksubmitdiv"> 
	<div class="inside">
		<div id="submitlink" class="submitbox"> <h3 style="cursor: default;"><?php 
    _wsl_e("Why, hello there", 'wordpress-social-login');
    ?>
</h3>
			<div id="minor-publishing"> 

				<div style="display:none;"><input type="submit" value="Save" class="button" id="save" name="save"></div>

				<div id="misc-publishing-actions">
					<div class="misc-pub-section"> 
						<p style="line-height: 19px;font-size: 13px;" align="justify">
							<?php 
    _wsl_e('If you are still new to things, we recommend that you read the <b><a href="http://hybridauth.sourceforge.net/wsl/index.html" target="_blank">Plugin User Guide</a></b> and to make sure your server settings meet this <b><a href="options-general.php?page=wordpress-social-login&amp;wslp=diagnostics">Plugin Requirements</a></b>', 'wordpress-social-login');
    ?>
.
						</p>
						<p style="line-height: 19px;" align="justify">
							<?php 
    _wsl_e('If you run into any issue then refer to <b><a href="options-general.php?page=wordpress-social-login&wslp=help">Help & Support</a></b> to konw how to reach me', 'wordpress-social-login');
    ?>
.
						</p> 
					</div>
				</div> 
			</div>

			<div id="major-publishing-actions"> 
				<div id="publishing-action">
					<input type="submit" value="<?php 
    _wsl_e('Save Settings', 'wordpress-social-login');
    ?>
" class="button-large button-primary" name="save" >
				</div>
				<div class="clear"></div>
			</div> 
		</div>
	</div>
</div>
<?php 
    // HOOKABLE:
    do_action("wsl_component_networks_whyhello_end");
}
Ejemplo n.º 8
0
function wsl_component_tools()
{
    // HOOKABLE:
    do_action("wsl_component_tools_start");
    include "wsl.components.tools.actions.php";
    include "wsl.components.tools.sidebar.php";
    $action = isset($_REQUEST['do']) ? $_REQUEST['do'] : null;
    if (in_array($action, array('diagnostics', 'sysinfo', 'uninstall', 'repair'))) {
        if (isset($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'])) {
            include "wsl.components.tools.actions.job.php";
            do_action('wsl_component_tools_do_' . $action);
        } else {
            ?>
				<div style="margin: 4px 0 20px;" class="fade error wsl-error-db-tables">
					<p>
						<?php 
            _wsl_e('The URL nonce is not valid', 'wordpress-social-login');
            ?>
! 
					</p>
				</div>	
			<?php 
        }
    } else {
        ?>
 
			<div class="metabox-holder columns-2" id="post-body">
				<table width="100%"> 
					<tr valign="top">
						<td> 
							<?php 
        wsl_component_tools_sections();
        ?>
						</td>
						<td width="10"></td>
						<td width="400">
							<?php 
        wsl_component_tools_sidebar();
        ?>
						</td>
					</tr>
				</table>
			</div>
		<?php 
    }
    // HOOKABLE:
    do_action("wsl_component_tools_end");
}
function wsl_component_users_profiles($user_id)
{
    // HOOKABLE:
    do_action("wsl_component_users_profiles_start");
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/16x16/';
    $linked_accounts = wsl_get_stored_hybridauth_user_profiles_by_user_id($user_id);
    // is it a WSL user?
    if (!$linked_accounts) {
        ?>
<div style="padding: 15px; margin-bottom: 8px; border: 1px solid #ddd; background-color: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);">
	<?php 
        _wsl_e("This's not a WSL user!", 'wordpress-social-login');
        ?>
.
</div>
<?php 
        return;
    }
    # http://hybridauth.sourceforge.net/userguide/Profile_Data_User_Profile.html
    $ha_profile_fields = array(array('field' => 'identifier', 'label' => _wsl__("Provider user ID", 'wordpress-social-login'), 'description' => _wsl__("The Unique user's ID on the connected provider. Depending on the provider, this field can be an number, Email, URL, etc", 'wordpress-social-login')), array('field' => 'profileURL', 'label' => _wsl__("Profile URL", 'wordpress-social-login'), 'description' => _wsl__("Link to the user profile on the provider web site", 'wordpress-social-login')), array('field' => 'webSiteURL', 'label' => _wsl__("Website URL", 'wordpress-social-login'), 'description' => _wsl__("User website, blog or web page", 'wordpress-social-login')), array('field' => 'photoURL', 'label' => _wsl__("Photo URL", 'wordpress-social-login'), 'description' => _wsl__("Link to user picture or avatar on the provider web site", 'wordpress-social-login')), array('field' => 'displayName', 'label' => _wsl__("Display name", 'wordpress-social-login'), 'description' => _wsl__("User Display name. If not provided by social network, WSL will return a concatenation of the user first and last name", 'wordpress-social-login')), array('field' => 'description', 'label' => _wsl__("Description", 'wordpress-social-login'), 'description' => _wsl__("A short about me", 'wordpress-social-login')), array('field' => 'firstName', 'label' => _wsl__("First name", 'wordpress-social-login'), 'description' => _wsl__("User's first name", 'wordpress-social-login')), array('field' => 'lastName', 'label' => _wsl__("Last name", 'wordpress-social-login'), 'description' => _wsl__("User's last name", 'wordpress-social-login')), array('field' => 'gender', 'label' => _wsl__("Gender", 'wordpress-social-login'), 'description' => _wsl__("User's gender. Values are 'female', 'male' or blank", 'wordpress-social-login')), array('field' => 'language', 'label' => _wsl__("Language", 'wordpress-social-login'), 'description' => _wsl__("User's language", 'wordpress-social-login')), array('field' => 'age', 'label' => _wsl__("Age", 'wordpress-social-login'), 'description' => _wsl__("User' age. Note that WSL do not calculate this field. We return it as it was provided", 'wordpress-social-login')), array('field' => 'birthDay', 'label' => _wsl__("Birth day", 'wordpress-social-login'), 'description' => _wsl__("The day in the month in which the person was born. Not to confuse it with 'Birth date'", 'wordpress-social-login')), array('field' => 'birthMonth', 'label' => _wsl__("Birth month", 'wordpress-social-login'), 'description' => _wsl__("The month in which the person was born", 'wordpress-social-login')), array('field' => 'birthYear', 'label' => _wsl__("Birth year", 'wordpress-social-login'), 'description' => _wsl__("The year in which the person was born", 'wordpress-social-login')), array('field' => 'email', 'label' => _wsl__("Email", 'wordpress-social-login'), 'description' => _wsl__("User's email address. Note: some providers like Facebook and Google can provide verified emails. Users with the same verified email will be automatically linked", 'wordpress-social-login')), array('field' => 'phone', 'label' => _wsl__("Phone", 'wordpress-social-login'), 'description' => _wsl__("User's phone number", 'wordpress-social-login')), array('field' => 'address', 'label' => _wsl__("Address", 'wordpress-social-login'), 'description' => _wsl__("User's address", 'wordpress-social-login')), array('field' => 'country', 'label' => _wsl__("Country", 'wordpress-social-login'), 'description' => _wsl__("User's country", 'wordpress-social-login')), array('field' => 'region', 'label' => _wsl__("Region", 'wordpress-social-login'), 'description' => _wsl__("User's state or region", 'wordpress-social-login')), array('field' => 'city', 'label' => _wsl__("City", 'wordpress-social-login'), 'description' => _wsl__("User's city", 'wordpress-social-login')), array('field' => 'zip', 'label' => _wsl__("Zip", 'wordpress-social-login'), 'description' => _wsl__("User's zipcode", 'wordpress-social-login')));
    $user_data = get_userdata($user_id);
    add_thickbox();
    $actions = array('edit_details' => '<a class="button button-secondary thickbox" href="' . admin_url('user-edit.php?user_id=' . $user_id . '&TB_iframe=true&width=1150&height=550') . '">' . _wsl__('Edit user details', 'wordpress-social-login') . '</a>', 'show_contacts' => '<a class="button button-secondary" href="' . admin_url('options-general.php?page=wordpress-social-login&wslp=contacts&uid=' . $user_id) . '">' . _wsl__('Show user contacts list', 'wordpress-social-login') . '</a>');
    // HOOKABLE:
    $actions = apply_filters('wsl_component_users_profiles_alter_actions_list', $actions, $user_id);
    ?>
<style>
	table td, table th { border: 1px solid #DDDDDD; }
	table th label { font-weight: bold; }
	.form-table th { width:120px; text-align:right; }
	p.description { font-size: 11px ! important; margin:0 ! important;}
</style>

<script>
	function confirmDeleteWSLUser()
	{
		return confirm( <?php 
    echo json_encode(_wsl__("Are you sure you want to delete the user's social profiles and contacts?\n\nNote: The associated WordPress user won't be deleted.", 'wordpress-social-login'));
    ?>
 );
	}
</script>

<div style="margin-top: 15px;padding: 15px; margin-bottom: 8px; border: 1px solid #ddd; background-color: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);">
 	<h3 style="margin:0;"><?php 
    echo sprintf(_wsl__("%s's social profiles", 'wordpress-social-login'), $user_data->display_name);
    ?>
</h3>

	<p style="float: <?php 
    if (is_rtl()) {
        echo 'left';
    } else {
        echo 'right';
    }
    ?>
;margin-top:-23px">
		<?php 
    echo implode(' ', $actions);
    ?>
	</p>
</div>

<div style="padding: 20px; border: 1px solid #ddd; background-color: #fff;">
	<table class="wp-list-table widefat">
		<tr><th width="200"><label><?php 
    _wsl_e("Wordpress User ID", 'wordpress-social-login');
    ?>
</label></th><td><?php 
    echo $user_data->ID;
    ?>
</td></tr>
		<tr><th width="200"><label><?php 
    _wsl_e("Username", 'wordpress-social-login');
    ?>
</label></th><td><?php 
    echo $user_data->user_login;
    ?>
</td></tr>
		<tr><th><label><?php 
    _wsl_e("Display name", 'wordpress-social-login');
    ?>
</label></th><td><?php 
    echo $user_data->display_name;
    ?>
</td></tr>
		<tr><th><label><?php 
    _wsl_e("E-mail", 'wordpress-social-login');
    ?>
</label></th><td><a href="mailto:<?php 
    echo $user_data->user_email;
    ?>
" target="_blank"><?php 
    echo $user_data->user_email;
    ?>
</a></td></tr>
		<tr><th><label><?php 
    _wsl_e("Website", 'wordpress-social-login');
    ?>
</label></th><td><a href="<?php 
    echo $user_data->user_url;
    ?>
" target="_blank"><?php 
    echo $user_data->user_url;
    ?>
</a></td></tr>
		<tr><th><label><?php 
    _wsl_e("Registered", 'wordpress-social-login');
    ?>
</label></th><td><?php 
    echo $user_data->user_registered;
    ?>
</td></tr>
		</tr>
	 </table>
</div>

<?php 
    foreach ($linked_accounts as $link) {
        ?>
<div style="margin-top:15px;padding: 5px 20px 20px; border: 1px solid #ddd; background-color: #fff;">

<h4><img src="<?php 
        echo $assets_base_url . strtolower($link->provider) . '.png';
        ?>
" style="vertical-align:top;width:16px;height:16px;" /> <?php 
        _wsl_e("User profile", 'wordpress-social-login');
        ?>
 <small><?php 
        echo sprintf(_wsl__("as provided by %s", 'wordpress-social-login'), $link->provider);
        ?>
 </small></h4>

<table class="wp-list-table widefat">
	<?php 
        $profile_fields = (array) $link;
        foreach ($ha_profile_fields as $item) {
            $item['field'] = strtolower($item['field']);
            ?>
			<tr>
				<th width="200">
					<label><?php 
            echo $item['label'];
            ?>
</label>
				</th>
				<td>
					<?php 
            if (isset($profile_fields[$item['field']]) && $profile_fields[$item['field']]) {
                $field_value = $profile_fields[$item['field']];
                if (in_array($item['field'], array('profileurl', 'websiteurl', 'email'))) {
                    ?>
									<a href="<?php 
                    if ($item['field'] == 'email') {
                        echo 'mailto:';
                    }
                    echo $field_value;
                    ?>
" target="_blank"><?php 
                    echo $field_value;
                    ?>
</a>
								<?php 
                } elseif ($item['field'] == 'photourl') {
                    ?>
									<a href="<?php 
                    echo $field_value;
                    ?>
" target="_blank"><img width="36" height="36" align="left" src="<?php 
                    echo $field_value;
                    ?>
" style="margin-right: 5px;" > <?php 
                    echo $field_value;
                    ?>
</a>
								<?php 
                } else {
                    echo $field_value;
                }
                ?>
								<p class="description">
									<?php 
                echo $item['description'];
                ?>
.
								</p>
							<?php 
            }
            ?>
				</td>
			</tr>
		<?php 
        }
        ?>
</table>
</div>
<?php 
    }
    // HOOKABLE:
    do_action("wsl_component_users_profiles_end");
}
function wsl_component_tools_uninstall()
{
    ?>
<div class="stuffbox">
	<h3>
		<label><?php 
    _wsl_e("Uninstall", 'wordpress-social-login');
    ?>
</label>
	</h3>
	<div class="inside"> 
		<p>
			<?php 
    _wsl_e('This will permanently delete all Wordpress Social Login tables and stored options from your WordPress database', 'wordpress-social-login');
    ?>
. 
			<?php 
    _wsl_e('Once you delete WSL database tables and stored options, there is NO going back. Please be certain', 'wordpress-social-login');
    ?>
. 
		</p>

		<a class="button-danger" href="<?php 
    echo wp_nonce_url('options-general.php?page=wordpress-social-login&wslp=tools&do=uninstall');
    ?>
" onClick="return confirm('Do you really want to Delete all Wordpress Social Login tables and options?\n\nPlease confirm that you have read and understood the abovementioned by clicking OK.');"><?php 
    _wsl_e("Delete all Wordpress Social Login tables and options", 'wordpress-social-login');
    ?>
</a>
	</div>
</div>
<?php 
}
function wsl_component_networks_setup()
{
    // HOOKABLE:
    do_action("wsl_component_networks_setup_start");
    global $wpdb;
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
    if (isset($_REQUEST["enable"]) && $_REQUEST["enable"]) {
        $provider_id = $_REQUEST["enable"];
        update_option('wsl_settings_' . $provider_id . '_enabled', 1);
    }
    ?>
 
<script>
	function toggleproviderkeys(idp){
		if(typeof jQuery=="undefined"){
			alert( "Error: WordPress Social Login require jQuery to be installed on your wordpress in order to work!" );

			return;
		}

		if(jQuery('#wsl_settings_' + idp + '_enabled').val()==1){
			jQuery('.wsl_tr_settings_' + idp).show();
		}
		else{
			jQuery('.wsl_tr_settings_' + idp).hide();
			jQuery('.wsl_div_settings_help_' + idp).hide();
		}
		
		return false;
	}

	function toggleproviderhelp(idp){
		if(typeof jQuery=="undefined"){
			alert( "Error: WordPress Social Login require jQuery to be installed on your wordpress in order to work!" );

			return false;
		}

		jQuery('.wsl_div_settings_help_' + idp).show();
		
		return false;
	}
</script>
<?php 
    $nbprovider = 0;
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/16x16/';
    foreach ($WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG as $item) {
        $provider_id = @$item["provider_id"];
        $provider_name = @$item["provider_name"];
        $require_client_id = @$item["require_client_id"];
        $provide_email = @$item["provide_email"];
        $provider_new_app_link = @$item["new_app_link"];
        $provider_userguide_section = @$item["userguide_section"];
        $provider_callback_url = "";
        if (!(isset($item["default_network"]) && $item["default_network"] || get_option('wsl_settings_' . $provider_id . '_enabled'))) {
            continue;
        }
        // default endpoint_url
        $endpoint_url = WORDPRESS_SOCIAL_LOGIN_HYBRIDAUTH_ENDPOINT_URL;
        // overwrite endpoint_url if need'd
        if (get_option('wsl_settings_base_url')) {
            $endpoint_url = strtolower(get_option('wsl_settings_base_url') . '/hybridauth/');
        }
        if (isset($item["callback"]) && $item["callback"]) {
            $provider_callback_url = '<span style="color:green">' . $endpoint_url . '?hauth.done=' . $provider_id . '</span>';
        }
        $setupsteps = 0;
        ?>
  
		<a name="setup<?php 
        echo strtolower($provider_id);
        ?>
"></a> 
		<div class="stuffbox" id="namediv">
			<h3>
				<label for="name" class="wp-neworks-label">
					<img alt="<?php 
        echo $provider_name;
        ?>
" title="<?php 
        echo $provider_name;
        ?>
" src="<?php 
        echo $assets_base_url . strtolower($provider_id) . '.png';
        ?>
" style="vertical-align: top;width:16px;height:16px;" /> <?php 
        echo $provider_name;
        ?>
				</label>
			</h3>
			<div class="inside">
				<table class="form-table editcomment">
					<tbody>
						<tr>
							<td style="width:110px"><?php 
        _wsl_e("Enabled", 'wordpress-social-login');
        ?>
:</td>
							<td>
								<select 
									name="<?php 
        echo 'wsl_settings_' . $provider_id . '_enabled';
        ?>
" 
									id="<?php 
        echo 'wsl_settings_' . $provider_id . '_enabled';
        ?>
" 
									onChange="toggleproviderkeys('<?php 
        echo $provider_id;
        ?>
')" 
								>
									<option value="1" <?php 
        if (get_option('wsl_settings_' . $provider_id . '_enabled')) {
            echo "selected";
        }
        ?>
 >Yes</option>
									<option value="0" <?php 
        if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
            echo "selected";
        }
        ?>
 >No</option>
								</select>
							</td>
							<td style="width:140px">&nbsp;</td>
						</tr>

						<?php 
        if ($provider_new_app_link) {
            ?>
							<?php 
            if ($require_client_id) {
                // key or id ?
                ?>
								<tr valign="top" <?php 
                if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
                    echo 'style="display:none"';
                }
                ?>
 class="wsl_tr_settings_<?php 
                echo $provider_id;
                ?>
" >
									<td><?php 
                _wsl_e("Application ID", 'wordpress-social-login');
                ?>
:</td>
									<td><input type="text" name="<?php 
                echo 'wsl_settings_' . $provider_id . '_app_id';
                ?>
" value="<?php 
                echo get_option('wsl_settings_' . $provider_id . '_app_id');
                ?>
" ></td>
									<td><a href="javascript:void(0)" onClick="toggleproviderhelp('<?php 
                echo $provider_id;
                ?>
')"><?php 
                _wsl_e("Where do I get this info?", 'wordpress-social-login');
                ?>
</a></td>
								</tr> 
							<?php 
            } else {
                ?>
								<tr valign="top" <?php 
                if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
                    echo 'style="display:none"';
                }
                ?>
 class="wsl_tr_settings_<?php 
                echo $provider_id;
                ?>
" >
									<td><?php 
                _wsl_e("Application Key", 'wordpress-social-login');
                ?>
:</td>
									<td><input type="text" name="<?php 
                echo 'wsl_settings_' . $provider_id . '_app_key';
                ?>
" value="<?php 
                echo get_option('wsl_settings_' . $provider_id . '_app_key');
                ?>
" ></td>
									<td><a href="javascript:void(0)" onClick="toggleproviderhelp('<?php 
                echo $provider_id;
                ?>
')"><?php 
                _wsl_e("Where do I get this info?", 'wordpress-social-login');
                ?>
</a></td>
								</tr>  
							<?php 
            }
            ?>
	 
								<tr valign="top" <?php 
            if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
                echo 'style="display:none"';
            }
            ?>
 class="wsl_tr_settings_<?php 
            echo $provider_id;
            ?>
" >
									<td><?php 
            _wsl_e("Application Secret", 'wordpress-social-login');
            ?>
:</td>
									<td><input type="text" name="<?php 
            echo 'wsl_settings_' . $provider_id . '_app_secret';
            ?>
" value="<?php 
            echo get_option('wsl_settings_' . $provider_id . '_app_secret');
            ?>
" ></td>
									<td><a href="javascript:void(0)" onClick="toggleproviderhelp('<?php 
            echo $provider_id;
            ?>
')"><?php 
            _wsl_e("Where do I get this info?", 'wordpress-social-login');
            ?>
</a></td>
								</tr>
						<?php 
        }
        // if require registration
        ?>
 
					</tbody>
				</table> 
				<?php 
        if (in_array($provider_id, array("Twitter", "Identica", "Tumblr", "Goodreads", "500px", "Vkontakte", "Gowalla", "Steam"))) {
            ?>
				<br />
				<hr />
				<p style="margin-left:12px;margin-bottom:0px;"> 
					<b  style="color:#CB4B16;"><?php 
            _wsl_e("Note", 'wordpress-social-login');
            ?>
:</b> 
					
					<?php 
            echo sprintf(_wsl__("<b>%s</b> do not provide their user's email address and by default a random email will then be generated for them instead", 'wordpress-social-login'), $provider_name);
            ?>
. 
					
					<?php 
            _wsl_e('To change this behaviour and to force new registered users to provide their emails before they get in, goto <b><a href="options-general.php?page=wordpress-social-login&wslp=bouncer">Bouncer</a></b> and enable <b>Profile Completion</b>', 'wordpress-social-login');
            ?>
.
				</p>
				<?php 
        }
        ?>
 
				<br />
				<div
					class="wsl_div_settings_help_<?php 
        echo $provider_id;
        ?>
" 
					style="<?php 
        if (isset($_REQUEST["enable"]) && !isset($_REQUEST["settings-updated"]) && $_REQUEST["enable"] == $provider_id) {
            echo "-";
        }
        // <= lolz
        ?>
display:none;" 
				> 
					<hr class="wsl" />
					<?php 
        if ($provider_new_app_link) {
            ?>
 
						<?php 
            _wsl_e('<span style="color:#CB4B16;">Application</span> id and secret (also sometimes referred as <span style="color:#CB4B16;">Customer</span> key and secret or <span style="color:#CB4B16;">Client</span> id and secret) are what we call an application credentials', 'wordpress-social-login');
            ?>
. 
						
						<?php 
            echo sprintf(_wsl__('This application will link your website <code>%s</code> to <code>%s API</code> and these credentials are needed in order for <b>%s</b> users to access your website', 'wordpress-social-login'), $_SERVER["SERVER_NAME"], $provider_name, $provider_name);
            ?>
. 
						<br />
						
						<?php 
            _wsl_e("These credentials may also differ in format, name and content depending on the social network.", 'wordpress-social-login');
            ?>
 
						<br />
						<br />
						
						<?php 
            echo sprintf(_wsl__('To enable authentication with this provider and to register a new <b>%s API Application</b>, carefully follow the steps', 'wordpress-social-login'), $provider_name);
            ?>
						:<br />
					<?php 
        } else {
            ?>
  
							<p><?php 
            echo sprintf(_wsl__('<b>Done.</b> Nothing more required for <b>%s</b>', 'wordpress-social-login'), $provider_name);
            ?>
.</p> 
					<?php 
        }
        ?>
  
					<div class="wsl_div_settings_help_<?php 
        echo $provider_id;
        ?>
" style="margin-left:40px;">
						<?php 
        if ($provider_new_app_link) {
            ?>
 
								<p><?php 
            echo "<b>" . ++$setupsteps . "</b>.";
            ?>
 Go to <a href="<?php 
            echo $provider_new_app_link;
            ?>
" target ="_blanck"><?php 
            echo $provider_new_app_link;
            ?>
</a> and <b>create a new application</b>.</p>

								<?php 
            if ($provider_id == "Google") {
                ?>
										<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 On the <b>Dashboard sidebar</b> click on <b>API Access</b> then Click <em style="color:#CB4B16;">"Create an OAuth 2.0 client ID..."</em>.</p> 
								<?php 
            }
            ?>
  

								<?php 
            if ($provider_id == "Google") {
                ?>
  
												</p>
												<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 On the <b>"Create Client ID"</b> popup :
												<br />&nbsp;&nbsp; - Enter a product name (the name of your website will do).
												<br />&nbsp;&nbsp; - Enter the URL for a logo if you like.
												<br />&nbsp;&nbsp; - Click Next.
												<br />&nbsp;&nbsp; - Select <em style="color:#CB4B16;">"Web application"</em> as the application type.
												<br />&nbsp;&nbsp; - Then switch to advanced settings by clicking on <b>(more options)</b>
												.</p>
								<?php 
            } else {
                ?>
  
										<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 Fill out any required fields such as the application name and description.</p> 
								<?php 
            }
            ?>
 

								<?php 
            if ($provider_callback_url) {
                ?>
										<p>
												<?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 Provide this URL as the <b>Callback URL</b> for your application:
												<br />
												<?php 
                echo $provider_callback_url;
                ?>
										</p>
								<?php 
            }
            ?>
 

								<?php 
            if ($provider_id == "MySpace") {
                ?>
										<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 Put your website domain in the <b>External Url</b> and <b>External Callback Validation</b> fields. This should match with the current hostname <em style="color:#CB4B16;"><?php 
                echo $_SERVER["SERVER_NAME"];
                ?>
</em>.</p>
								<?php 
            }
            ?>
 

								<?php 
            if ($provider_id == "Live") {
                ?>
										<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 Put your website domain in the <b>Redirect Domain</b> field. This should match with the current hostname <em style="color:#CB4B16;"><?php 
                echo $_SERVER["SERVER_NAME"];
                ?>
</em>.</p>
								<?php 
            }
            ?>
 

								<?php 
            if ($provider_id == "Facebook") {
                ?>
										<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 Put your website domain in the <b>Site Url</b> field. This should match with the current hostname <em style="color:#CB4B16;"><?php 
                echo $_SERVER["SERVER_NAME"];
                ?>
</em>.</p> 
								<?php 
            }
            ?>
 

								<?php 
            if ($provider_id == "LinkedIn") {
                ?>
										<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 Put your website domain in the <b>Integration URL</b> field. This should match with the current hostname <em style="color:#CB4B16;"><?php 
                echo $_SERVER["SERVER_NAME"];
                ?>
</em>.</p> 
										<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 Set the <b>Application Type</b> to <em style="color:#CB4B16;">Web Application</em>.</p> 
								<?php 
            }
            ?>
 

								<?php 
            if ($provider_id == "Twitter") {
                ?>
										<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 Put your website domain in the <b>Application Website</b> and <b>Application Callback URL</b> fields. This should match with the current hostname <em style="color:#CB4B16;"><?php 
                echo $_SERVER["SERVER_NAME"];
                ?>
</em>.</p>   
								<?php 
            }
            ?>
 
								
								<p><?php 
            echo "<b>" . ++$setupsteps . "</b>.";
            ?>
 Once you have registered, copy and past the created application credentials into this setup page.</p>  
						<?php 
        }
        ?>
 
						
						<?php 
        if ($provider_id == "Facebook") {
            ?>
							<hr /> 
							<table style="text-align: center;margin-bottom:12px;">
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/facebook/1.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/facebook/1.png"></a></td>
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/facebook/2.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/facebook/2.png"></a></td>
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/facebook/3.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/facebook/3.png"></a></td>
							</table> 
							<hr />
						<?php 
        }
        ?>
 
						<?php 
        if ($provider_id == "Google") {
            ?>
							<hr /> 
							<table style="text-align: center;margin-bottom:12px;">
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/google/1.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/google/1.png"></a></td>
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/google/2.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/google/2.png"></a></td>
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/google/3.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/google/3.png"></a></td>
							</table> 
							<hr />
						<?php 
        }
        ?>
 
						<?php 
        if ($provider_id == "Twitter") {
            ?>
							<hr /> 
							<table style="text-align: center;margin-bottom:12px;">
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/twitter/1.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/twitter/1.png"></a></td>
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/twitter/2.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/twitter/2.png"></a></td>
								<td><a class="span4 thumbnail" href="http://hybridauth.sf.net/userguide/img/setup/twitter/3.png" target="_blank"><img src="http://hybridauth.sf.net/userguide/img/setup/twitter/3.png"></a></td>
							</table> 
							<hr />
						<?php 
        }
        ?>
 
						<?php 
        if ($provider_new_app_link) {
            ?>
 
							<p>
								<b><?php 
            _wsl_e("And that's it!", 'wordpress-social-login');
            ?>
</b> 
								<br />
								<?php 
            echo sprintf(_wsl__('If for some reason you still can\'t figure it out, first try to a) <a class="button-primary" href="https://www.google.com/search?q=%s API create application" target="_blank">Google it</a>, then check it on b) <a class="button-primary" href="http://www.youtube.com/results?search_query=%s API create application " target="_blank">Youtube</a> and if nothing works c) <a class="button-primary" href="options-general.php?page=wordpress-social-login&wslp=help">ask for support</a>', 'wordpress-social-login'), $provider_name, $provider_name);
            ?>
.
							</p> 
						<?php 
        }
        ?>
 
					</div>
				</div>
			</div>
		</div>
<?php 
    }
    ?>
	<input type="submit" class="button-primary" value="<?php 
    _wsl_e("Save Settings", 'wordpress-social-login');
    ?>
" />
<?php 
    // HOOKABLE:
    do_action("wsl_component_networks_setup_end");
}
Ejemplo n.º 12
0
function wsl_render_login_form_admin_head_user_profile_generate_html()
{
    if (!is_user_logged_in()) {
        return;
    }
    // HOOKABLE: allow users to generate their own
    if (apply_filters('wsl_hook_profile_widget', null)) {
        return;
    }
    # if ob_start()/ob_end_clean() dont work for you then i can do nothing for you
    ob_start();
    global $current_user;
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
    get_currentuserinfo();
    $user_id = $current_user->ID;
    $linked_accounts = wsl_get_user_linked_accounts_by_user_id($user_id);
    // if not WSL user, then nothing to show, yet
    if (!$linked_accounts) {
        return;
    }
    if (empty($social_icon_set)) {
        $social_icon_set = "wpzoom/";
    } else {
        $social_icon_set .= "/";
    }
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/32x32/' . $social_icon_set;
    ?>
 
<h3><?php 
    _wsl_e("Social networks", 'wordpress-social-login');
    ?>
</h3> 
<table class="form-table">  
	<tr>  
		<td valign="top">
			<table id="wsl-user-profile-injected-table-b">
				<tr>
					<th width="80"><?php 
    _wsl_e("Provider", 'wordpress-social-login');
    ?>
</th>
					<th><?php 
    _wsl_e("Identity", 'wordpress-social-login');
    ?>
</th> 
				</tr>
				<?php 
    foreach ($linked_accounts as $item) {
        $identity = $item->profileurl;
        $photourl = $item->photourl;
        if (!$identity) {
            $identity = $item->identifier;
        }
        ?>
					<tr>
						<td>
							<?php 
        if ($photourl) {
            ?>
								<img src="<?php 
            echo $photourl;
            ?>
" style="vertical-align: top;width:16px;height:16px;" > 
							<?php 
        } else {
            ?>
								<img src="<?php 
            echo $assets_base_url . strtolower($item->provider) . '.png';
            ?>
" style="vertical-align: top;width:16px;height:16px;" />
							<?php 
        }
        ?>
 
							<?php 
        echo ucfirst($item->provider);
        ?>
						</td>
						<td><?php 
        echo $identity;
        ?>
</td> 
					</tr>
				<?php 
    }
    ?>
			</table>
		</td> 
	</tr> 
	</tr> 
<?php 
    // Bouncer :: Allow authentication && Linking accounts is enabled
    if (get_option('wsl_settings_bouncer_authentication_enabled') == 1 && get_option('wsl_settings_bouncer_linking_accounts_enabled') == 1) {
        $list_connected_providers = wsl_get_list_connected_providers();
        ?>
	
	<tr>    
		<td valign="top">
			<b><?php 
        _wsl_e("Add more identities", 'wordpress-social-login');
        ?>
</b>
			<br />
			<?php 
        foreach ($WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG as $item) {
            $provider_id = @$item["provider_id"];
            $provider_name = @$item["provider_name"];
            $dispaly = true;
            // only one linked account per provider is permitted!!
            foreach ($linked_accounts as $link) {
                if ($link->provider == $provider_id) {
                    $dispaly = false;
                }
            }
            if ($dispaly) {
                $social_icon_set = get_option('wsl_settings_social_icon_set');
                $current_page_url = admin_url("profile.php");
                if (get_option('wsl_settings_' . $provider_id . '_enabled')) {
                    ?>
							<a href="<?php 
                    echo WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL;
                    ?>
/services/authenticate.php?provider=<?php 
                    echo $provider_id;
                    ?>
&link=1&redirect_to=<?php 
                    echo urlencode($current_page_url);
                    ?>
" title="Connect with <?php 
                    echo $provider_name;
                    ?>
"  style="text-decoration:none;" target="_blank">
								<img alt="<?php 
                    echo $provider_name;
                    ?>
" title="<?php 
                    echo $provider_name;
                    ?>
" src="<?php 
                    echo $assets_base_url . strtolower($provider_id) . '.png';
                    ?>
" />
							</a>
							<?php 
                }
            }
        }
        ?>
		</td> 
	</tr> 
<?php 
    }
    if ($list_connected_providers) {
        ?>
	<tr> 
		<td>
			<b><?php 
        _wsl_e("Currently connected to:", 'wordpress-social-login');
        ?>
</b> 
			<?php 
        echo implode(', ', $list_connected_providers);
        ?>
		</td> 
	</tr> 
<?php 
    }
    ?>

</table>
<?php 
    $html = ob_get_contents();
    ob_end_clean();
    return addslashes(preg_replace('/\\s+/', ' ', $html));
}
function wsl_component_bouncer_setup()
{
    // HOOKABLE:
    do_action("wsl_component_bouncer_setup_start");
    ?>
<div  id="post-body-content"> 
 
	<div id="namediv" class="stuffbox">
		<h3>
			<label for="name"><?php 
    _wsl_e("WSL Widget", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside"> 
			<p> 
				<?php 
    _wsl_e("Here you can tell Bouncer if you are accepting new users registration and authentication into your website or not any more. Note that Bouncer only works for WSL and will not interfere with users authenticating through the regulars wordpress Login and Register pages with their usernames and passwords (to to achieve that kind of restrictions, you may need to use another plugin(s) in combination with WSL).", 'wordpress-social-login');
    ?>
			</p> 
			<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">  
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("Accept new registration", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td> 
					<select name="wsl_settings_bouncer_registration_enabled">
						<option <?php 
    if (get_option('wsl_settings_bouncer_registration_enabled') == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
						<option <?php 
    if (get_option('wsl_settings_bouncer_registration_enabled') == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option> 
					</select>
				</td>
			  </tr> 
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("Allow authentication", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td> 
					<select name="wsl_settings_bouncer_authentication_enabled">
						<option <?php 
    if (get_option('wsl_settings_bouncer_authentication_enabled') == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
						<option <?php 
    if (get_option('wsl_settings_bouncer_authentication_enabled') == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option> 
					</select>
				</td>
			  </tr> 
			</table>
		</div>
	</div>

	<div id="namediv" class="stuffbox">
		<h3>
			<label for="name"><?php 
    _wsl_e("Profile Completion", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside hideinside"> 
			<p>
				<?php 
    _wsl_e("Select required fields. If a social network doesn't return them, Bouncer will then ask your visitors to fill additional form to provide them when registering.", 'wordpress-social-login');
    ?>
 
			</p>
			<p class="description">
				<?php 
    _wsl_e("You may activate <b>Profile Completion</b> for both <b>E-mail</b> and <b>Username</b>, but keep in mind, the idea behind <b>social login</b> is to avoid forms and remove all the hassle of registration", 'wordpress-social-login');
    ?>
.
			</p>
			<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">  
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("Require E-mail", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td> 
					<select name="wsl_settings_bouncer_profile_completion_require_email">
						<option <?php 
    if (get_option('wsl_settings_bouncer_profile_completion_require_email') == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
						<option <?php 
    if (get_option('wsl_settings_bouncer_profile_completion_require_email') == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option> 
					</select>
				</td>
			  </tr>
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("Allow Username change", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td>
					<select name="wsl_settings_bouncer_profile_completion_change_username">
						<option <?php 
    if (get_option('wsl_settings_bouncer_profile_completion_change_username') == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
						<option <?php 
    if (get_option('wsl_settings_bouncer_profile_completion_change_username') == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option> 
					</select>
				</td>
			  </tr>
			</table>  
		</div>
	</div>

	<div id="namediv" class="stuffbox">
		<h3>
			<label for="name"><?php 
    _wsl_e("User Moderation", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside hideinside"> 
			<p> 
				<?php 
    _wsl_e("<b>User Moderation</b> will define how <b>Bouncer</b> should behave with new regsitred users:", 'wordpress-social-login');
    ?>
			</p>
			<ul style="margin-left:30px">
				<li><?php 
    _wsl_e("<b>None</b>: No moderation required.", 'wordpress-social-login');
    ?>
</li>
				<li><?php 
    _wsl_e('<b>E-mail Confirmation</b>: New users will need to be confirm their e-mail address before they may log in', 'wordpress-social-login');
    ?>
.</li>
				<li><?php 
    _wsl_e('<b>Admin Approval</b>: New users will need to be approved by an administrator before they may log in', 'wordpress-social-login');
    ?>
.</li>
			</ul> 
			<p class="description">
				<?php 
    _wsl_e('Both <b>Admin Approval</b> and <b>E-mail Confirmation</b> requires <a href="http://wordpress.org/extend/plugins/theme-my-login/" target="_blank">Theme My Login</a> plugin to be installed. As there is no point for <b>WordPress Social Login</b> to reinvent the wheel', 'wordpress-social-login');
    ?>
.
			</p> 
			<p class="description">
				<?php 
    _wsl_e('<b>User Moderation</b> was purposely made compatible with the <a href="http://wordpress.org/extend/plugins/theme-my-login/" target="_blank">Theme My Login</a> for a number reasons: That plugin is good at what he does, a hell of a lot of people are using it and many have asked for it', 'wordpress-social-login');
    ?>
.
			</p> 
			<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">  
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("User Moderation", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td> 
					<select name="wsl_settings_bouncer_new_users_moderation_level">
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_moderation_level') == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("None", 'wordpress-social-login');
    ?>
</option> 
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_moderation_level') == 101) {
        echo "selected";
    }
    ?>
 value="101"><?php 
    _wsl_e("E-mail Confirmation &mdash; Yield to Theme My Login plugin", 'wordpress-social-login');
    ?>
</option> 
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_moderation_level') == 102) {
        echo "selected";
    }
    ?>
 value="102"><?php 
    _wsl_e("Admin Approval &mdash; Yield to Theme My Login plugin", 'wordpress-social-login');
    ?>
</option> 
					</select>
				</td>
			  </tr>
			</table>
		</div>
	</div>

	<div id="namediv" class="stuffbox">
		<h3>
			<label for="name"><?php 
    _wsl_e("Membership level", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside hideinside"> 
			<p>
				<?php 
    _wsl_e('Here you can define the default role for new users authenticating through WSL. The <code>Administrator</code> and <code>Editor</code> roles are not available for safety reasons', 'wordpress-social-login');
    ?>
.
			</p> 
			<p>
				<?php 
    _wsl_e('For more information about wordpress users roles and capabilities refer to <a href="http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table" target="_blank">http://codex.wordpress.org/Roles_and_Capabilities</a>', 'wordpress-social-login');
    ?>
.
			</p> 
			<p>
				<?php 
    _wsl_e('If <b>User Moderation</b> is set to <code>Admin Approval</code> then <b>Membership level</b> will be ignored', 'wordpress-social-login');
    ?>
.
			</p> 
			<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">  
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("New User Default Role", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td> 
					<select name="wsl_settings_bouncer_new_users_membership_default_role">
						<optgroup label="<?php 
    _wsl_e("Safe", 'wordpress-social-login');
    ?>
:">
							<option value="default"     <?php 
    if (get_option('wsl_settings_bouncer_new_users_membership_default_role') == "default") {
        echo "selected";
    }
    ?>
 ><?php 
    _wsl_e("&mdash; Wordpress User Default Role &mdash;", 'wordpress-social-login');
    ?>
</option> 
							<option value="wslnorole"   <?php 
    if (get_option('wsl_settings_bouncer_new_users_membership_default_role') == "wslnorole") {
        echo "selected";
    }
    ?>
 ><?php 
    _wsl_e("&mdash; No role for this site  &mdash;", 'wordpress-social-login');
    ?>
</option> 
							<option value="subscriber"  <?php 
    if (get_option('wsl_settings_bouncer_new_users_membership_default_role') == "subscriber") {
        echo "selected";
    }
    ?>
 ><?php 
    _wsl_e("Subscriber", 'wordpress-social-login');
    ?>
</option> 
						</optgroup>

						<optgroup label="<?php 
    _wsl_e("Be careful with these", 'wordpress-social-login');
    ?>
:">  
							<option value="author"      <?php 
    if (get_option('wsl_settings_bouncer_new_users_membership_default_role') == "author") {
        echo "selected";
    }
    ?>
 ><?php 
    _wsl_e("Author", 'wordpress-social-login');
    ?>
</option>
							<option value="contributor" <?php 
    if (get_option('wsl_settings_bouncer_new_users_membership_default_role') == "contributor") {
        echo "selected";
    }
    ?>
 ><?php 
    _wsl_e("Contributor", 'wordpress-social-login');
    ?>
</option> 
						</optgroup>
					</select>  
				</td>
			  </tr>  
			</table>  
		</div>
	</div>

	<div id="namediv" class="stuffbox">
		<h3>
			<label for="name"><?php 
    _wsl_e("Filters by emails domains name", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside hideinside">
			<p>
				<?php 
    _wsl_e("Restrict registration to a limited number of domains name.", 'wordpress-social-login');
    ?>
				<?php 
    _wsl_e("Insert one email address per line and try to keep this list short. On <code>Bounce text</code> insert the text you want to display for rejected users. ex: <code>gmail.com</code>, without '@'.", 'wordpress-social-login');
    ?>
			</p>
			<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">  
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("Enabled", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td> 
					<select name="wsl_settings_bouncer_new_users_restrict_domain_enabled">
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_restrict_domain_enabled') == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_restrict_domain_enabled') == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option> 
					</select>
				</td>
			  </tr>   
			  <tr>
				<td width="200" align="right" valign="top"><p><strong><?php 
    _wsl_e("Domains list", 'wordpress-social-login');
    ?>
 :</strong></p></td>
				<td>
					<textarea style="width:100%;height:60px;margin-top:6px;" name="wsl_settings_bouncer_new_users_restrict_domain_list"><?php 
    echo get_option('wsl_settings_bouncer_new_users_restrict_domain_list');
    ?>
</textarea> 
				</td>
			  </tr>  
			  <tr>
				<td width="200" align="right" valign="top"><p><strong><?php 
    _wsl_e("Bounce text", 'wordpress-social-login');
    ?>
 :</strong></p></td>
				<td> 
					<?php 
    wsl_render_wp_editor("wsl_settings_bouncer_new_users_restrict_domain_text_bounce", get_option('wsl_settings_bouncer_new_users_restrict_domain_text_bounce'));
    ?>
				</td>
			  </tr>
			</table>  
		</div>
	</div>

	<div id="namediv" class="stuffbox">
		<h3>
			<label for="name"><?php 
    _wsl_e("Filters by e-mails addresses", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside hideinside"> 
			<p>
				<?php 
    _wsl_e("Restrict registration to a limited number of emails addresses.", 'wordpress-social-login');
    ?>
 
				<?php 
    _wsl_e("Insert one email address per line and try to keep this list short. On <code>Bounce text</code> insert the text you want to display for rejected users. ex: <code>hybridauth@gmail.com</code>", 'wordpress-social-login');
    ?>
 
			</p>
			<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">  
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("Enabled", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td> 
					<select name="wsl_settings_bouncer_new_users_restrict_email_enabled">
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_restrict_email_enabled') == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_restrict_email_enabled') == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option> 
					</select>
				</td>
			  </tr>   
			  <tr>
				<td width="200" align="right" valign="top"><p><strong><?php 
    _wsl_e("E-mails list", 'wordpress-social-login');
    ?>
 :</strong></p></td>
				<td> 
					<textarea style="width:100%;height:60px;margin-top:6px;" name="wsl_settings_bouncer_new_users_restrict_email_list"><?php 
    echo get_option('wsl_settings_bouncer_new_users_restrict_email_list');
    ?>
</textarea>  
				</td>
			  </tr>  
			  <tr>
				<td width="200" align="right" valign="top"><p><strong><?php 
    _wsl_e("Bounce text", 'wordpress-social-login');
    ?>
 :</strong></p></td>
				<td> 
					<?php 
    wsl_render_wp_editor("wsl_settings_bouncer_new_users_restrict_email_text_bounce", get_option('wsl_settings_bouncer_new_users_restrict_email_text_bounce'));
    ?>
				</td>
			  </tr>  
			</table>  
		</div>
	</div>

	<div id="namediv" class="stuffbox">
		<h3>
			<label for="name"><?php 
    _wsl_e("Filters by profile urls", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside hideinside"> 
			<p>
				<?php 
    _wsl_e("Restrict registration to a limited number of profile urls.", 'wordpress-social-login');
    ?>
				<?php 
    _wsl_e("<b>Note</b>: If a social network provide the user email, then use 'Filters by e-mails addresses' instead. Providers like Facebook provide multiples profiles URLs per user and WSL won't be able to reconize them.", 'wordpress-social-login');
    ?>
				<?php 
    _wsl_e("Insert one email address per line and try to keep this list short. On <code>Bounce text</code> insert the text you want to display for rejected users. ex: <code>http://twitter.com/HybridAuth</code>, <code>https://plus.google.com/u/0/108839241301472312344</code>", 'wordpress-social-login');
    ?>
			</p>
			<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">  
			  <tr>
				<td width="200" align="right"><strong><?php 
    _wsl_e("Enabled", 'wordpress-social-login');
    ?>
 :</strong></td>
				<td> 
					<select name="wsl_settings_bouncer_new_users_restrict_profile_enabled">
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_restrict_profile_enabled') == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
						<option <?php 
    if (get_option('wsl_settings_bouncer_new_users_restrict_profile_enabled') == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option> 
					</select>
				</td>
			  </tr>   
			  <tr>
				<td width="200" align="right" valign="top"><p><strong><?php 
    _wsl_e("Profile urls", 'wordpress-social-login');
    ?>
 :</strong></p></td>
				<td>
					<textarea style="width:100%;height:60px;margin-top:6px;" name="wsl_settings_bouncer_new_users_restrict_profile_list"><?php 
    echo get_option('wsl_settings_bouncer_new_users_restrict_profile_list');
    ?>
</textarea>  
				</td>
			  </tr>  
			  <tr>
				<td width="200" align="right" valign="top"><p><strong><?php 
    _wsl_e("Bounce text", 'wordpress-social-login');
    ?>
 :</strong></p></td>
				<td> 
					<?php 
    wsl_render_wp_editor("wsl_settings_bouncer_new_users_restrict_profile_text_bounce", get_option('wsl_settings_bouncer_new_users_restrict_profile_text_bounce'));
    ?>
				</td>
			  </tr>  
			</table>  
		</div>
	</div>

	<br />

	<div style="margin-left:5px;margin-top:-20px;"> 
		<input type="submit" class="button-primary" value="<?php 
    _wsl_e("Save Settings", 'wordpress-social-login');
    ?>
" /> 
	</div>
</div>
<?php 
    // HOOKABLE:
    do_action("wsl_component_bouncer_setup_end");
}
Ejemplo n.º 14
0
/**
* Generate the HTML content of WSL Widget
*
* Note:
*   WSL shortcode arguments are still experimental and might change in future versions.
*
*   [wordpress_social_login
*        auth_mode="login"
*        caption="Connect with"
*        enable_providers="facebook|google"
*        restrict_content="wsl_user_logged_in"
*        assets_base_url="http://example.com/wp-content/uploads/2022/01/"
*   ]
*
*   Overall, WSL widget work with these simple rules :
*      1. Shortcode arguments rule over the defaults
*      2. Filters hooks rule over shortcode arguments
*      3. Bouncer rules over everything
*/
function wsl_render_auth_widget($args = array())
{
    $auth_mode = isset($args['mode']) && $args['mode'] ? $args['mode'] : 'login';
    // validate auth-mode
    if (!in_array($auth_mode, array('login', 'link', 'test'))) {
        return;
    }
    // auth-mode eq 'login' => display wsl widget only for NON logged in users
    // > this is the default mode of wsl widget.
    if ($auth_mode == 'login' && is_user_logged_in()) {
        return;
    }
    // auth-mode eq 'link' => display wsl widget only for LOGGED IN users
    // > this will allows users to manually link other social network accounts to their WordPress account
    if ($auth_mode == 'link' && !is_user_logged_in()) {
        return;
    }
    // auth-mode eq 'test' => display wsl widget only for LOGGED IN users only on dashboard
    // > used in Authentication Playground on WSL admin dashboard
    if ($auth_mode == 'test' && !is_user_logged_in() && !is_admin()) {
        return;
    }
    // Bouncer :: Allow authentication?
    if (get_option('wsl_settings_bouncer_authentication_enabled') == 2) {
        return;
    }
    // HOOKABLE: This action runs just before generating the WSL Widget.
    do_action('wsl_render_auth_widget_start');
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
    ob_start();
    // Icon set. If eq 'none', we show text instead
    $social_icon_set = get_option('wsl_settings_social_icon_set');
    // wpzoom icons set, is shown by default
    if (empty($social_icon_set)) {
        $social_icon_set = "wpzoom/";
    }
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/32x32/' . $social_icon_set . '/';
    $assets_base_url = isset($args['assets_base_url']) && $args['assets_base_url'] ? $args['assets_base_url'] : $assets_base_url;
    // HOOKABLE:
    $assets_base_url = apply_filters('wsl_render_auth_widget_alter_assets_base_url', $assets_base_url);
    // get the current page url, which we will use to redirect the user to,
    // unless Widget::Force redirection is set to 'yes', then this will be ignored and Widget::Redirect URL will be used instead
    $redirect_to = wsl_get_current_url();
    // Use the provided redirect_to if it is given and this is the login page.
    if (in_array($GLOBALS["pagenow"], array("wp-login.php", "wp-register.php")) && !empty($_REQUEST["redirect_to"])) {
        $redirect_to = $_REQUEST["redirect_to"];
    }
    // build the authentication url which will call for wsl_process_login() : action=wordpress_social_authenticate
    $authenticate_base_url = site_url('wp-login.php', 'login_post') . (strpos(site_url('wp-login.php', 'login_post'), '?') ? '&' : '?') . "action=wordpress_social_authenticate&mode=login&";
    // if not in mode login, we overwrite the auth base url
    // > admin auth playground
    if ($auth_mode == 'test') {
        $authenticate_base_url = home_url() . "/?action=wordpress_social_authenticate&mode=test&";
    } elseif ($auth_mode == 'link') {
        $authenticate_base_url = home_url() . "/?action=wordpress_social_authenticate&mode=link&";
    }
    // Connect with caption
    $connect_with_label = _wsl__(get_option('wsl_settings_connect_with_label'), 'wordpress-social-login');
    $connect_with_label = isset($args['caption']) ? $args['caption'] : $connect_with_label;
    // HOOKABLE:
    $connect_with_label = apply_filters('wsl_render_auth_widget_alter_connect_with_label', $connect_with_label);
    ?>

<!--
	wsl_render_auth_widget
	WordPress Social Login <?php 
    echo wsl_get_version();
    ?>
.
	http://wordpress.org/plugins/wordpress-social-login/
-->
<?php 
    // Widget::Custom CSS
    $widget_css = get_option('wsl_settings_authentication_widget_css');
    // HOOKABLE:
    $widget_css = apply_filters('wsl_render_auth_widget_alter_widget_css', $widget_css, $redirect_to);
    // show the custom widget css if not empty
    if (!empty($widget_css)) {
        ?>

<style type="text/css">
<?php 
        echo preg_replace(array('%/\\*(?:(?!\\*/).)*\\*/%s', '/\\s{2,}/', "/\\s*([;{}])[\r\n\t\\s]/", '/\\s*;\\s*/', '/\\s*{\\s*/', '/;?\\s*}\\s*/'), array('', ' ', '$1', ';', '{', '}'), $widget_css);
        ?>
</style>
<?php 
    }
    ?>

<div class="wp-social-login-widget">

	<div class="wp-social-login-connect-with"><?php 
    echo $connect_with_label;
    ?>
</div>

	<div class="wp-social-login-provider-list">
<?php 
    // Widget::Authentication display
    $wsl_settings_use_popup = get_option('wsl_settings_use_popup');
    // if a user is visiting using a mobile device, WSL will fall back to more in page
    $wsl_settings_use_popup = function_exists('wp_is_mobile') ? wp_is_mobile() ? 2 : $wsl_settings_use_popup : $wsl_settings_use_popup;
    $no_idp_used = true;
    // display provider icons
    foreach ($WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG as $item) {
        $provider_id = isset($item["provider_id"]) ? $item["provider_id"] : '';
        $provider_name = isset($item["provider_name"]) ? $item["provider_name"] : '';
        // provider enabled?
        if (get_option('wsl_settings_' . $provider_id . '_enabled')) {
            // restrict the enabled providers list
            if (isset($args['enable_providers'])) {
                $enable_providers = explode('|', $args['enable_providers']);
                // might add a couple of pico seconds
                if (!in_array(strtolower($provider_id), $enable_providers)) {
                    continue;
                }
            }
            // build authentication url
            $authenticate_url = $authenticate_base_url . "provider=" . $provider_id . "&redirect_to=" . urlencode($redirect_to);
            // http://codex.wordpress.org/Function_Reference/esc_url
            $authenticate_url = esc_url($authenticate_url);
            // in case, Widget::Authentication display is set to 'popup', then we overwrite 'authenticate_url'
            // > /assets/js/connect.js will take care of the rest
            if ($wsl_settings_use_popup == 1 && $auth_mode != 'test') {
                $authenticate_url = "javascript:void(0);";
            }
            // HOOKABLE: allow user to rebuilt the auth url
            $authenticate_url = apply_filters('wsl_render_auth_widget_alter_authenticate_url', $authenticate_url, $provider_id, $auth_mode, $redirect_to, $wsl_settings_use_popup);
            // HOOKABLE: allow use of other icon sets
            $provider_icon_markup = apply_filters('wsl_render_auth_widget_alter_provider_icon_markup', $provider_id, $provider_name, $authenticate_url);
            if ($provider_icon_markup != $provider_id) {
                echo $provider_icon_markup;
            } else {
                ?>

		<a rel="nofollow" href="<?php 
                echo $authenticate_url;
                ?>
" title="<?php 
                echo sprintf(_wsl__("%s", 'wordpress-social-login'), $provider_name);
                ?>
" class="wp-social-login-provider wp-social-login-provider-<?php 
                echo strtolower($provider_id);
                ?>
" data-provider="<?php 
                echo $provider_id;
                ?>
">
			<?php 
                if ($social_icon_set == 'none') {
                    echo apply_filters('wsl_render_auth_widget_alter_provider_name', '' . $provider_name);
                } else {
                    ?>
<img alt="<?php 
                    echo $provider_name;
                    ?>
" title="<?php 
                    echo sprintf(_wsl__("%s", 'wordpress-social-login'), $provider_name);
                    ?>
" src="<?php 
                    echo $assets_base_url . strtolower($provider_id) . '.png';
                    ?>
" /><?php 
                }
                ?>
		</a>
<?php 
            }
            $no_idp_used = false;
        }
    }
    ?>
	<?php 
    // no provider enabled?
    if ($no_idp_used) {
        ?>
		<p style="background-color: #FFFFE0;border:1px solid #E6DB55;padding:5px;">
			<?php 
        _wsl_e('<strong>WordPress Social Login is not configured yet</strong>.<br />Please navigate to <strong>Settings &gt; WP Social Login</strong> to configure this plugin.<br />For more information, refer to the <a rel="nofollow" href="http://miled.github.io/wordpress-social-login">online user guide</a>.', 'wordpress-social-login');
        ?>
.
		</p>
		<style>#wp-social-login-connect-with{display:none;}</style>
<?php 
    }
    ?>

	</div>

	<div class="wp-social-login-widget-clearing"></div>

</div>

<?php 
    // provide popup url for hybridauth callback
    if ($wsl_settings_use_popup == 1) {
        ?>
<input type="hidden" id="wsl_popup_base_url" value="<?php 
        echo esc_url($authenticate_base_url);
        ?>
" />
<input type="hidden" id="wsl_login_form_uri" value="<?php 
        echo esc_url(site_url('wp-login.php', 'login_post'));
        ?>
" />

<?php 
    }
    // HOOKABLE: This action runs just after generating the WSL Widget.
    do_action('wsl_render_auth_widget_end');
    ?>
<!-- wsl_render_auth_widget -->

<?php 
    // Display WSL debugging area bellow the widget.
    // wsl_display_dev_mode_debugging_area(); // ! keep this line commented unless you know what you are doing :)
    return ob_get_clean();
}
function wsl_component_tools_do_uninstall()
{
    wsl_database_uninstall();
    ?>
<div class="metabox-holder columns-2" id="post-body">
	<div class="stuffbox">
		<h3>
			<label><?php 
    _wsl_e("Uninstall", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside"> 
			<p>
				<?php 
    _wsl_e("All Wordpress Social Login tables and stored options are permanently deleted from your WordPress database", 'wordpress-social-login');
    ?>
.
			</p>
			<p>
				<?php 
    _wsl_e("To delete Wordpress Social Login files from your WordPress website, you may deactivate and uninstall it through the 'Plugins' menu in WordPress", 'wordpress-social-login');
    ?>
.
			</p>
			<p>
				<?php 
    _wsl_e("Thank you for using Wordpress Social Login", 'wordpress-social-login');
    ?>
.
			</p>
			<p>
				<?php 
    _wsl_e("Good bye", 'wordpress-social-login');
    ?>
.
			</p>
			<hr />
			<a class="button-secondary" href="options-general.php?page=wordpress-social-login&wslp=tools">&larr; <?php 
    _wsl_e("Back to Tools", 'wordpress-social-login');
    ?>
</a>
		</div>
	</div>
</div>
<?php 
}
Ejemplo n.º 16
0
function wsl_process_login_new_users_gateway($provider, $redirect_to, $hybridauth_user_profile)
{
    // HOOKABLE:
    do_action("wsl_process_login_new_users_gateway_start", $provider, $redirect_to, $hybridauth_user_profile);
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/16x16/';
    // remove wsl widget
    remove_action('register_form', 'wsl_render_auth_widget_in_wp_register_form');
    $hybridauth_user_email = sanitize_email($hybridauth_user_profile->email);
    $hybridauth_user_login = sanitize_user($hybridauth_user_profile->displayName, true);
    $hybridauth_user_avatar = $hybridauth_user_profile->photoURL;
    $hybridauth_user_website = $hybridauth_user_profile->webSiteURL;
    $hybridauth_user_link = $hybridauth_user_profile->profileURL;
    $hybridauth_user_login = trim(str_replace(array(' ', '.'), '_', $hybridauth_user_login));
    $hybridauth_user_login = trim(str_replace('__', '_', $hybridauth_user_login));
    $requested_user_email = isset($_REQUEST["user_email"]) ? trim($_REQUEST["user_email"]) : $hybridauth_user_email;
    $requested_user_login = isset($_REQUEST["user_login"]) ? trim($_REQUEST["user_login"]) : $hybridauth_user_login;
    $requested_user_email = apply_filters('wsl_new_users_gateway_alter_requested_email', $requested_user_email);
    $requested_user_login = apply_filters('wsl_new_users_gateway_alter_requested_login', $requested_user_login);
    $user_id = 0;
    $shall_pass = false;
    $bouncer_account_linking = false;
    $account_linking_errors = array();
    $bouncer_profile_completion = false;
    $profile_completion_errors = array();
    $linking_enabled = get_option('wsl_settings_bouncer_accounts_linking_enabled');
    // $linking_enabled = 2; // overide linking_enabled
    if (isset($_REQUEST["bouncer_account_linking"])) {
        if ($linking_enabled == 2) {
            return wsl_process_login_render_notice_page(_wsl__("Not tonight.", 'wordpress-social-login'));
        }
        $bouncer_account_linking = true;
        $username = isset($_REQUEST["user_login"]) ? trim($_REQUEST["user_login"]) : '';
        $password = isset($_REQUEST["user_password"]) ? trim($_REQUEST["user_password"]) : '';
        # http://codex.wordpress.org/Function_Reference/wp_authenticate
        $user = wp_authenticate($username, $password);
        // WP_Error object?
        if (is_wp_error($user)) {
            // we give no useful hint.
            $account_linking_errors[] = sprintf(_wsl__('<strong>ERROR</strong>: Invalid username or incorrect password. <a href="%s">Lost your password</a>?', 'wordpress-social-login'), wp_lostpassword_url(home_url()));
        } elseif (is_a($user, 'WP_User')) {
            $user_id = $user->ID;
            $shall_pass = true;
        }
    } elseif (isset($_REQUEST["bouncer_profile_completion"])) {
        $require_email = get_option('wsl_settings_bouncer_profile_completion_require_email');
        $change_username = get_option('wsl_settings_bouncer_profile_completion_change_username');
        $extra_fields = get_option('wsl_settings_bouncer_profile_completion_hook_extra_fields');
        // Bouncer::Profile Completion enabled?
        // > if not enabled we just let the user pass
        if ($require_email == 2 && $change_username == 2 && $extra_fields == 2) {
            $shall_pass = true;
        } else {
            $bouncer_profile_completion = true;
            /**
             * Code based on wpmu_validate_user_signup()
             *
             * Ref: http://codex.wordpress.org/Function_Reference/wpmu_validate_user_signup
             */
            # {{{ validate usermail
            if ($require_email == 1) {
                if (empty($requested_user_email)) {
                    $profile_completion_errors[] = _wsl__('<strong>ERROR</strong>: Please type your e-mail address.', 'wordpress-social-login');
                }
                if (!is_email($requested_user_email)) {
                    $profile_completion_errors[] = _wsl__('<strong>ERROR</strong>: Please enter a valid email address.', 'wordpress-social-login');
                }
                if (wsl_wp_email_exists($requested_user_email)) {
                    $profile_completion_errors[] = _wsl__('<strong>ERROR</strong>: Sorry, that email address is already used!', 'wordpress-social-login');
                }
            }
            # }}} validate usermail
            # {{{ validate username (called login in wsl)
            if ($change_username == 1) {
                $illegal_names = array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator');
                $illegal_names = apply_filters('wsl_new_users_gateway_alter_illegal_names', $illegal_names);
                if (in_array($requested_user_login, $illegal_names) == true) {
                    $profile_completion_errors[] = _wsl__('<strong>ERROR</strong>: That username is not allowed.', 'wordpress-social-login');
                }
                if (strlen($requested_user_login) < 4) {
                    $profile_completion_errors[] = _wsl__('<strong>ERROR</strong>: Username must be at least 4 characters.', 'wordpress-social-login');
                }
                if (strpos(' ' . $requested_user_login, '_') != false) {
                    $profile_completion_errors[] = _wsl__('<strong>ERROR</strong>: Sorry, usernames may not contain the character &#8220;_&#8221;!', 'wordpress-social-login');
                }
                if (preg_match('/^[0-9]*$/', $requested_user_login)) {
                    $profile_completion_errors[] = _wsl__('<strong>ERROR</strong>: Sorry, usernames must have letters too!', 'wordpress-social-login');
                }
                if (username_exists($requested_user_login)) {
                    $profile_completion_errors[] = _wsl__('<strong>ERROR</strong>: Sorry, that username already exists!', 'wordpress-social-login');
                }
            }
            # }}} validate username
            # ... well, that was a lot of sorries.
            # {{{ extra fields
            if ($extra_fields == 1) {
                $errors = new WP_Error();
                $errors = apply_filters('registration_errors', $errors, $requested_user_login, $requested_user_email);
                if ($errors = $errors->get_error_messages()) {
                    foreach ($errors as $error) {
                        $profile_completion_errors[] = $error;
                    }
                }
            }
            # }}} extra fields
            $profile_completion_errors = apply_filters('wsl_new_users_gateway_alter_profile_completion_errors', $profile_completion_errors);
            // all check?
            if (!$profile_completion_errors) {
                $shall_pass = true;
            }
        }
    }
    if ($shall_pass == false) {
        ?>
 
<!DOCTYPE html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title><?php 
        echo get_bloginfo('name');
        ?>
</title>
		<style type="text/css"> 
			html, body {
				height: 100%;
				margin: 0;
				padding: 0;
			}
			body {
				background: none repeat scroll 0 0 #f1f1f1;
				font-size: 14px;
				color: #444;
				font-family: "Open Sans",sans-serif;
			}
			hr {
				border-color: #eeeeee;
				border-style: none none solid;
				border-width: 0 0 1px;
				margin: 2px 0 0;
			}
			h4 {
				font-size: 14px;
				margin-bottom: 10px;
			}
			#login { 
				width: 616px;
				margin: auto;
				padding: 114px 0 0;
			}
			#login-panel {
				background: none repeat scroll 0 0 #fff;
				box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
				margin: 2em auto;
				box-sizing: border-box;
				display: inline-block;
				padding: 70px 0 15px;
				position: relative;
				text-align: center;
				width: 100%;
			}
			#avatar {
				margin-left: -76px;
				top: -80px;
				left: 50%;
				padding: 4px;
				position: absolute;
			}
			#avatar img {
				background: none repeat scroll 0 0 #fff;
				border: 3px solid #f1f1f1;
				border-radius: 75px !important;
				box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
				height: 145px;
				width: 145px;
			}
			#welcome {
				height: 55px;
				margin: 15px 20px 35px;
			}
			#idp-icon {
				position: absolute;
				margin-top: 2px;
				margin-left: -19px;
			}
			#login-form{
				margin: 0;
				padding: 0;
			}
			.button-primary {
				background-color: #21759b;
				background-image: linear-gradient(to bottom, #2a95c5, #21759b);
				border-color: #21759b #21759b #1e6a8d;
				border-radius: 3px;
				border-style: solid;
				border-width: 1px;
				box-shadow: 0 1px 0 rgba(120, 200, 230, 0.5) inset;
				box-sizing: border-box;
				color: #fff;
				cursor: pointer;
				display: inline-block;
				float: none;
				font-size: 12px;
				height: 36px;
				line-height: 23px;
				margin: 0;
				padding: 0 10px 1px;
				text-decoration: none;
				text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
				white-space: nowrap;
			}
			button-primary.focus, .button-primary:hover{
				background:#1e8cbe;
				border-color:#0074a2;
				-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.6);
				box-shadow:inset 0 1px 0 rgba(120,200,230,.6);
				color:#fff
			}
			input[type="text"]{
				border: 1px solid #e5e5e5;
				box-shadow: 1px 1px 2px rgba(200, 200, 200, 0.2) inset;
				color: #555;
				font-size: 17px;
				height: 30px;
				line-height: 1;
				margin-bottom: 16px;
				margin-right: 6px;
				margin-top: 2px;
				outline: 0 none;
				padding: 3px;
				width: 100%;
			}
			input[type="text"]:focus{
				border-color:#5b9dd9;
				-webkit-box-shadow:0 0 2px rgba(30,140,190,.8);
				box-shadow:0 0 2px rgba(30,140,190,.8)
			}
			input[type="submit"]{
				float:right;
			}
			label{
				color:#777;
				font-size:14px;
				cursor:pointer;
				vertical-align:middle;
				text-align: left;
			}
			table {
				width:355px;
				margin-left:auto; 
				margin-right:auto;
			}
			#mapping-options {
				width:555px;
			}
			#mapping-authenticate {
				display:none;
			}
			#mapping-complete-info {
				display:none;
			}
			.error {
				display:none;
				background-color: #fff;
				border-left: 4px solid #dd3d36;
				box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
				margin: 0 21px;
				padding: 12px;	
				text-align:left;
			}
			.back-to-options {
				float: left;
				margin: 7px 0px;
			}
			.back-to-home {
				font-size: 12px;
				margin-top: -18px;
			}
			.back-to-home a {
				color: #999;
				text-decoration: none;
			}
			<?php 
        if ($linking_enabled == 2) {
            ?>
					#login {width: 400px;}
					#welcome, #mapping-options, #errors-account-linking, #mapping-complete-info {display: none;}
					#errors-profile-completion, #mapping-complete-info {display: block;}
					<?php 
        } elseif ($bouncer_account_linking) {
            ?>
					#login {width: 400px;}
					#welcome, #mapping-options, #errors-profile-completion, #mapping-complete-info {display: none;}
					#errors-account-linking, #mapping-authenticate {display: block;}
					<?php 
        } elseif ($bouncer_profile_completion) {
            ?>
					#login {width: 400px;}
					#welcome, #mapping-options, #errors-account-linking, #mapping-complete-info {display: none;}
					#errors-profile-completion, #mapping-complete-info {display: block;}
					<?php 
        }
        ?>
		</style>
		<script>
			// good old time
			function toggleEl( el, display )
			{
				if( el = document.getElementById( el ) )
				{
					el.style.display = display;
				}
			}

			function toggleWidth( el, width )
			{
				if( el = document.getElementById( el ) )
				{
					el.style.width = width;
				}
			}

			function display_mapping_options()
			{
				toggleWidth( 'login', '616px' );

				toggleEl( 'welcome'        , 'block' );
				toggleEl( 'mapping-options', 'block' );
				
				toggleEl( 'errors-profile-completion', 'none' );
				toggleEl( 'mapping-authenticate'     , 'none' );

				toggleEl( 'errors-account-linking', 'none' );
				toggleEl( 'mapping-complete-info' , 'none' );
			}

			function display_mapping_authenticate()
			{
				toggleWidth( 'login', '400px' );

				toggleEl( 'welcome'        , 'none' );
				toggleEl( 'mapping-options', 'none' );

				toggleEl( 'errors-account-linking', 'block' ); 
				toggleEl( 'mapping-authenticate'  , 'block' );

				toggleEl( 'errors-profile-completion', 'none' );
				toggleEl( 'mapping-complete-info'    ,'none' );
			}

			function display_mapping_complete_info()
			{
				toggleWidth( 'login', '400px' );

				toggleEl( 'welcome'        , 'none' );
				toggleEl( 'mapping-options', 'none' );

				toggleEl( 'errors-account-linking', 'none' );
				toggleEl( 'mapping-authenticate'  , 'none' );

				toggleEl( 'errors-profile-completion', 'block' );
				toggleEl( 'mapping-complete-info'    , 'block' );
			}
		</script>
	</head>
	<body>
		<div id="login">
			<div id="login-panel">
				<div id="avatar">
					<img src="<?php 
        echo $hybridauth_user_avatar;
        ?>
">
				</div>

				<div id="welcome">
					<img id="idp-icon" src="<?php 
        echo $assets_base_url . $provider;
        ?>
.png" > 
					<b><?php 
        printf(_wsl__("Hi %s", 'wordpress-social-login'), htmlentities($hybridauth_user_profile->displayName));
        ?>
</b>
					<p><?php 
        printf(_wsl__("You're now signed in with your %s account but you still one step away of getting into our website", 'wordpress-social-login'), $provider);
        ?>
.</p>

					<hr />
				</div>

				<table id="mapping-options" border="0">
					<tr>
						<?php 
        if ($linking_enabled == 1) {
            ?>
							<td valign="top"  width="50%" style="text-align:center;">
								<h4><?php 
            _wsl_e("Already have an account", 'wordpress-social-login');
            ?>
?</h4>
								<p style="font-size: 12px;"><?php 
            printf(_wsl__("Link your existing account on our website to your %s ID.", 'wordpress-social-login'), $provider);
            ?>
</p>
							</td>
						<?php 
        }
        ?>
						<td valign="top"  width="50%" style="text-align:center;">
							<h4><?php 
        _wsl_e("New to our website", 'wordpress-social-login');
        ?>
?</h4>
							<p style="font-size: 12px;"><?php 
        printf(_wsl__("Create a new account and it will be associated with your %s ID.", 'wordpress-social-login'), $provider);
        ?>
</p>
						</td>
					</tr>
					
					<tr>
						<?php 
        if ($linking_enabled == 1) {
            ?>
							<td valign="top"  width="50%" style="text-align:center;">
								<input type="button" value="<?php 
            _wsl_e("Link my account", 'wordpress-social-login');
            ?>
" class="button-primary" onclick="display_mapping_authenticate();" > 
							</td>
						<?php 
        }
        ?>
						<td valign="top"  width="50%" style="text-align:center;">
							<input type="button" value="<?php 
        _wsl_e("Create a new account", 'wordpress-social-login');
        ?>
" class="button-primary" onclick="display_mapping_complete_info();" > 
						</td>
					</tr>
				</table> 

				<?php 
        if ($account_linking_errors) {
            echo '<div id="errors-account-linking" class="error">';
            foreach ($account_linking_errors as $error) {
                ?>
<p><?php 
                echo $error;
                ?>
</p><?php 
            }
            echo '</div>';
        }
        if ($profile_completion_errors) {
            echo '<div id="errors-profile-completion" class="error">';
            foreach ($profile_completion_errors as $error) {
                ?>
<p><?php 
                echo $error;
                ?>
</p><?php 
            }
            echo '</div>';
        }
        ?>

				<form method="post" action="<?php 
        echo site_url('wp-login.php', 'login_post');
        ?>
" id="login-form">
					<table id="mapping-authenticate" border="0"> 
						<tr>
							<td valign="top"  width="50%" style="text-align:center;">
								<h4><?php 
        _wsl_e("Already have an account", 'wordpress-social-login');
        ?>
?</h4> 

								<p><?php 
        printf(_wsl__("Please enter your username and password of your existing account on our website. Once verified, it will linked to your % ID", 'wordpress-social-login'), ucfirst($provider));
        ?>
.</p>
							</td>
						</tr> 
						<tr>
							<td valign="bottom"  width="50%" style="text-align:left;">
								<label>
									<?php 
        _wsl_e("Username", 'wordpress-social-login');
        ?>
									<br />
									<input type="text" name="user_login" class="input" value=""  size="25" placeholder="" />
								</label>

								<label>
									<?php 
        _wsl_e("Password", 'wordpress-social-login');
        ?>
									<br />
									<input type="text" name="user_password" class="input" value="" size="25" placeholder="" />
								</label> 

								<input type="submit" value="<?php 
        _wsl_e("Continue", 'wordpress-social-login');
        ?>
" class="button-primary" > 
								
								<a href="javascript:void(0);" onclick="display_mapping_options();" class="back-to-options"><?php 
        _wsl_e("Back", 'wordpress-social-login');
        ?>
</a>
							</td>
						</tr>
					</table> 

					<input type="hidden" id="redirect_to" name="redirect_to" value="<?php 
        echo $redirect_to;
        ?>
"> 
					<input type="hidden" id="provider" name="provider" value="<?php 
        echo $provider;
        ?>
"> 
					<input type="hidden" id="action" name="action" value="wordpress_social_account_linking">
					<input type="hidden" id="bouncer_account_linking" name="bouncer_account_linking" value="1">
				</form>

				<form method="post" action="<?php 
        echo site_url('wp-login.php', 'login_post');
        ?>
" id="login-form"> 
					<table id="mapping-complete-info" border="0">
						<tr>
							<td valign="top"  width="50%" style="text-align:center;">
								<?php 
        if ($linking_enabled == 1) {
            ?>
									<h4><?php 
            _wsl_e("New to our website", 'wordpress-social-login');
            ?>
?</h4>
								<?php 
        }
        ?>

								<p><?php 
        printf(_wsl__("Please fill in your information in the form below. Once completed, you will be able to automatically sign into our website through your %s ID", 'wordpress-social-login'), ucfirst($provider));
        ?>
.</p>
							</td>
						</tr>
						<tr>
							<td valign="bottom"  width="50%" style="text-align:left;">
								<label>
									<?php 
        _wsl_e("Username", 'wordpress-social-login');
        ?>
									<br />
									<input type="text" name="user_name" class="input" value="<?php 
        echo $requested_user_login;
        ?>
" size="25" placeholder="" />
								</label>

								<label>
									<?php 
        _wsl_e("E-mail", 'wordpress-social-login');
        ?>
									<br />
									<input type="text" name="user_email" class="input" value="<?php 
        echo $requested_user_email;
        ?>
" size="25" placeholder="" />
								</label> 

								<?php 
        /**
         * Fires following the 'E-mail' field in the user registration form.
         *
         * hopefully, this won't become a pain in future
         *
         * Ref: http://codex.wordpress.org/Plugin_API/Action_Reference/register_form
         */
        $extra_fields = get_option('wsl_settings_bouncer_profile_completion_hook_extra_fields');
        if ($extra_fields == 1) {
            do_action('register_form');
        }
        ?>

								<input type="submit" value="<?php 
        _wsl_e("Continue", 'wordpress-social-login');
        ?>
" class="button-primary" > 

								<?php 
        if ($linking_enabled == 1) {
            ?>
									<a href="javascript:void(0);" onclick="display_mapping_options();" class="back-to-options"><?php 
            _wsl_e("Back", 'wordpress-social-login');
            ?>
</a>
								<?php 
        }
        ?>
							</td>
						</tr>
					</table> 

					<input type="hidden" id="redirect_to" name="redirect_to" value="<?php 
        echo $redirect_to;
        ?>
"> 
					<input type="hidden" id="provider" name="provider" value="<?php 
        echo $provider;
        ?>
"> 
					<input type="hidden" id="action" name="action" value="wordpress_social_account_linking">
					<input type="hidden" id="bouncer_profile_completion" name="bouncer_profile_completion" value="1">
				</form>
			</div>

			<p class="back-to-home">
				<a href="<?php 
        echo site_url();
        ?>
">&#8592; <?php 
        printf(_wsl__("Back to %s", 'wordpress-social-login'), get_bloginfo('name'));
        ?>
</a>
			</p>
		</div>

		<?php 
        // Development mode on?
        if (get_option('wsl_settings_development_mode_enabled')) {
            wsl_display_dev_mode_debugging_area();
        }
        ?>
 
	</body>
</html>
<?php 
        die;
    }
    return array($shall_pass, $user_id, $requested_user_login, $requested_user_email);
}
function wsl_component_networks_basicinsights()
{
    // HOOKABLE:
    do_action("wsl_component_networks_basicinsights_start");
    global $wpdb;
    $sql = "SELECT count( * ) as items FROM `{$wpdb->prefix}users`";
    $rs1 = $wpdb->get_results($sql);
    $sql = "SELECT count( * ) as items FROM `{$wpdb->prefix}usermeta` where meta_key = 'wsl_user'";
    $rs2 = $wpdb->get_results($sql);
    $total_users = (int) $rs1[0]->items;
    $total_users_wsl = (int) $rs2[0]->items;
    $users_conversion = 100 * $total_users_wsl / $total_users;
    if ($total_users_wsl && wsl_is_component_enabled("basicinsights")) {
        ?>
 
<div class="postbox " id="linksubmitdiv"> 
	<div class="inside">
		<div id="submitlink" class="submitbox"> 
			<h3 style="cursor: default;"><?php 
        _wsl_e("Insights", 'wordpress-social-login');
        ?>
</h3>
			<div id="minor-publishing">  
				<div id="misc-publishing-actions">
					<div style="padding:20px;padding-top:0px;"> 
						<h4 style="border-bottom:1px solid #ccc"><?php 
        _wsl_e("Conversions", 'wordpress-social-login');
        ?>
</h4>
						<table width="90%"> 
							<tr>
								<td width="60%"><?php 
        _wsl_e("WP users", 'wordpress-social-login');
        ?>
</td><td><?php 
        echo $total_users;
        ?>
</td>
							</tr>
							<tr>
								<td><?php 
        _wsl_e("WSL users", 'wordpress-social-login');
        ?>
</td><td><?php 
        echo $total_users_wsl;
        ?>
</td>
							</tr>
							<tr>
								<td><?php 
        _wsl_e("Conversions", 'wordpress-social-login');
        ?>
</td><td style="border-top:1px solid #ccc">+<b><?php 
        echo number_format($users_conversion, 2, '.', '');
        ?>
</b> %</td>
							</tr>
						</table>
						<?php 
        $sql = "SELECT meta_value, count( * ) as items FROM `{$wpdb->prefix}usermeta` where meta_key = 'wsl_user' group by meta_value order by items desc ";
        $rs1 = $wpdb->get_results($sql);
        $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/16x16/';
        ?>
 
						<h4 style="border-bottom:1px solid #ccc"><?php 
        _wsl_e("By provider", 'wordpress-social-login');
        ?>
</h4>
						<table width="90%">
							<?php 
        foreach ($rs1 as $item) {
            if (!$item->meta_value) {
                $item->meta_value = "Unknown";
            }
            ?>
									<tr>
										<td width="60%">
											<img src="<?php 
            echo $assets_base_url . strtolower($item->meta_value) . '.png';
            ?>
" style="vertical-align:top;width:16px;height:16px;" /> <?php 
            echo $item->meta_value;
            ?>
 
										</td>
										<td>
											<?php 
            echo $item->items;
            ?>
										</td>
									</tr>
								<?php 
        }
        ?>
 
							<tr>
								<td align="right">&nbsp;</td><td style="border-top:1px solid #ccc"><b><?php 
        echo $total_users_wsl;
        ?>
</b> <?php 
        _wsl_e("WSL users", 'wordpress-social-login');
        ?>
</td>
							</tr>
						</table> 
						<?php 
        $sql = "SELECT meta_value, count( * ) as items FROM `{$wpdb->prefix}usermeta` where meta_key = 'wsl_user_gender' group by meta_value order by items desc ";
        $rs = $wpdb->get_results($sql);
        ?>
						<h4 style="border-bottom:1px solid #ccc"><?php 
        _wsl_e("By gender", 'wordpress-social-login');
        ?>
</h4>
						<table width="90%">
							<?php 
        foreach ($rs as $item) {
            if (!$item->meta_value) {
                $item->meta_value = "Unknown";
            }
            ?>
									<tr>
										<td width="60%">
											<?php 
            echo ucfirst($item->meta_value);
            ?>
										</td>
										<td>
											<?php 
            echo $item->items;
            ?>
										</td>
									</tr>
								<?php 
        }
        ?>
						</table>
						<?php 
        $sql = "SELECT meta_value, count( * ) as items FROM `{$wpdb->prefix}usermeta` where meta_key = 'wsl_user_age' group by meta_value order by items desc limit 21";
        $rs = $wpdb->get_results($sql);
        ?>
						<h4 style="border-bottom:1px solid #ccc"><?php 
        _wsl_e("By age", 'wordpress-social-login');
        ?>
</h4>
						<table width="90%">
							<?php 
        $t_ages = 0;
        $n_ages = 0;
        foreach ($rs as $item) {
            if (!$item->meta_value) {
                $item->meta_value = "Unknown";
            } else {
                $t_ages += (int) $item->meta_value;
                $n_ages++;
            }
            ?>
									<tr>
										<td width="60%">
											<?php 
            echo $item->meta_value;
            ?>
										</td>
										<td>
											<?php 
            echo $item->items;
            ?>
										</td>
									</tr>
								<?php 
        }
        if ($n_ages) {
            $a_ages = $t_ages / $n_ages;
        }
        ?>
						</td>
						</tr>
						<tr>
							<td align="right">&nbsp;</td><td style="border-top:1px solid #ccc"><b><?php 
        echo number_format($a_ages, 1, '.', '');
        ?>
</b> <?php 
        _wsl_e("yrs in average", 'wordpress-social-login');
        ?>
</td>
						</tr>
						</table>
					</div>
				</div> 
			</div> 
		</div>
	</div>
</div> 
<?php 
    }
    // HOOKABLE:
    do_action("wsl_component_networks_basicinsights_end");
}
Ejemplo n.º 18
0
function wsl_component_authtest()
{
    // HOOKABLE:
    do_action("wsl_component_authtest_start");
    $adapter = null;
    $provider_id = isset($_REQUEST["provider"]) ? $_REQUEST["provider"] : null;
    $user_profile = null;
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/';
    if (!class_exists('Hybrid_Auth', false)) {
        require_once WORDPRESS_SOCIAL_LOGIN_ABS_PATH . "hybridauth/Hybrid/Auth.php";
    }
    try {
        $provider = Hybrid_Auth::getAdapter($provider_id);
        // make as few call as possible
        if (!(isset($_SESSION['wsl::userprofile']) && $_SESSION['wsl::userprofile'] && ($user_profile = json_decode($_SESSION['wsl::userprofile'])))) {
            $user_profile = $provider->getUserProfile();
            $_SESSION['wsl::userprofile'] = json_encode($user_profile);
        }
        $adapter = $provider->adapter;
    } catch (Exception $e) {
    }
    $ha_profile_fields = array(array('field' => 'identifier', 'label' => _wsl__("Provider user ID", 'wordpress-social-login')), array('field' => 'profileURL', 'label' => _wsl__("Profile URL", 'wordpress-social-login')), array('field' => 'webSiteURL', 'label' => _wsl__("Website URL", 'wordpress-social-login')), array('field' => 'photoURL', 'label' => _wsl__("Photo URL", 'wordpress-social-login')), array('field' => 'displayName', 'label' => _wsl__("Display name", 'wordpress-social-login')), array('field' => 'description', 'label' => _wsl__("Description", 'wordpress-social-login')), array('field' => 'firstName', 'label' => _wsl__("First name", 'wordpress-social-login')), array('field' => 'lastName', 'label' => _wsl__("Last name", 'wordpress-social-login')), array('field' => 'gender', 'label' => _wsl__("Gender", 'wordpress-social-login')), array('field' => 'language', 'label' => _wsl__("Language", 'wordpress-social-login')), array('field' => 'age', 'label' => _wsl__("Age", 'wordpress-social-login')), array('field' => 'birthDay', 'label' => _wsl__("Birth day", 'wordpress-social-login')), array('field' => 'birthMonth', 'label' => _wsl__("Birth month", 'wordpress-social-login')), array('field' => 'birthYear', 'label' => _wsl__("Birth year", 'wordpress-social-login')), array('field' => 'email', 'label' => _wsl__("Email", 'wordpress-social-login')), array('field' => 'phone', 'label' => _wsl__("Phone", 'wordpress-social-login')), array('field' => 'address', 'label' => _wsl__("Address", 'wordpress-social-login')), array('field' => 'country', 'label' => _wsl__("Country", 'wordpress-social-login')), array('field' => 'region', 'label' => _wsl__("Region", 'wordpress-social-login')), array('field' => 'city', 'label' => _wsl__("City", 'wordpress-social-login')), array('field' => 'zip', 'label' => _wsl__("Zip", 'wordpress-social-login')));
    ?>
<style>
	.widefat td, .widefat th { border: 1px solid #DDDDDD; }
	.widefat th label { font-weight: bold; }

	.wp-social-login-provider-list { padding: 10px; }
	.wp-social-login-provider-list a {text-decoration: none; }
	.wp-social-login-provider-list img{ border: 0 none; }
</style>

<div class="metabox-holder columns-2" id="post-body">
	<table width="100%">
		<tr valign="top">
			<td>
				<?php 
    if (!$adapter) {
        ?>
					<div style="padding: 15px; margin-bottom: 8px; border: 1px solid #ddd; background-color: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);">
						<p><?php 
        _wsl_e("Connect with a provider to get started", 'wordpress-social-login');
        ?>
.</p>
					</div>
				<?php 
    } else {
        ?>
					<div class="stuffbox">
						<h3>
							<label><?php 
        _wsl_e("Connected adapter specs", 'wordpress-social-login');
        ?>
</label>
						</h3>
						<div class="inside">
							<table class="wp-list-table widefat">
								<tr>
									<th width="200"><label><?php 
        _wsl_e("Provider", 'wordpress-social-login');
        ?>
</label></th>
									<td><?php 
        echo $adapter->providerId;
        ?>
</td>
								</tr>

								<?php 
        if (isset($adapter->openidIdentifier)) {
            ?>
									<tr>
										<th width="200"><label><?php 
            _wsl_e("OpenID Identifier", 'wordpress-social-login');
            ?>
</label></th>
										<td><?php 
            echo $adapter->openidIdentifier;
            ?>
</td>
									</tr>
								<?php 
        }
        ?>

								<?php 
        if (isset($adapter->scope)) {
            ?>
									<tr>
										<th width="200"><label><?php 
            _wsl_e("Scope", 'wordpress-social-login');
            ?>
</label></th>
										<td><?php 
            echo $adapter->scope;
            ?>
</td>
									</tr>
								<?php 
        }
        ?>

								<?php 
        if (isset($adapter->config['keys'])) {
            ?>
									<tr>
										<th width="200"><label><?php 
            _wsl_e("Application keys", 'wordpress-social-login');
            ?>
</label></th>
										<td><div style="max-width:650px"><?php 
            echo json_encode($adapter->config['keys']);
            ?>
</div></td>
									</tr>
								<?php 
        }
        ?>

								<?php 
        if ($adapter->token("access_token")) {
            ?>
									<tr>
										<th width="200"><label><?php 
            _wsl_e("Access token", 'wordpress-social-login');
            ?>
</label></th>
										<td><div style="max-width:650px"><?php 
            echo $adapter->token("access_token");
            ?>
</div></td>
									</tr>
								<?php 
        }
        ?>

								<?php 
        if ($adapter->token("access_token_secret")) {
            ?>
									<tr>
										<th width="200"><label><?php 
            _wsl_e("Access token secret", 'wordpress-social-login');
            ?>
</label></th>
										<td><?php 
            echo $adapter->token("access_token_secret");
            ?>
</td>
									</tr>
								<?php 
        }
        ?>

								<?php 
        if ($adapter->token("expires_in")) {
            ?>
									<tr>
										<th width="200"><label><?php 
            _wsl_e("Access token expires in", 'wordpress-social-login');
            ?>
</label></th>
										<td><?php 
            echo (int) $adapter->token("expires_at") - time();
            ?>
 <?php 
            _wsl_e("second(s)", 'wordpress-social-login');
            ?>
</td>
									</tr>
								<?php 
        }
        ?>

								<?php 
        if ($adapter->token("expires_at")) {
            ?>
									<tr>
										<th width="200"><label><?php 
            _wsl_e("Access token expires at", 'wordpress-social-login');
            ?>
</label></th>
										<td><?php 
            echo date(DATE_W3C, $adapter->token("expires_at"));
            ?>
</td>
									</tr>
								<?php 
        }
        ?>
							</table>
						</div>
					</div>

					<?php 
        $console = false;
        if (!isset($adapter->openidIdentifier)) {
            ?>
						<div class="stuffbox">
							<h3>
								<label><?php 
            _wsl_e("Connected adapter console", 'wordpress-social-login');
            ?>
</label>
							</h3>
							<div class="inside">
								<?php 
            $path = isset($adapter->api->api_base_url) ? $adapter->api->api_base_url : '';
            $path = isset($_REQUEST['console-path']) ? $_REQUEST['console-path'] : $path;
            $method = isset($_REQUEST['console-method']) ? $_REQUEST['console-method'] : '';
            $query = isset($_REQUEST['console-query']) ? $_REQUEST['console-query'] : '';
            $response = '';
            if ($path && in_array($method, array('GET', 'POST'))) {
                $console = true;
                try {
                    if ($method == 'GET') {
                        $response = $adapter->api->get($path . ($query ? '?' . $query : ''));
                    } else {
                        $response = $adapter->api->get($path, $query);
                    }
                    $response = $response ? $response : Hybrid_Error::getApiError();
                } catch (Exception $e) {
                    $response = "ERROR: " . $e->getMessage();
                }
            }
            ?>
								<form action="" method="post"/>
									<table class="wp-list-table widefat">
										<tr>
											<th width="200"><label><?php 
            _wsl_e("Path", 'wordpress-social-login');
            ?>
</label></th>
											<td><input type="text" style="width:96%" name="console-path" value="<?php 
            echo htmlentities($path);
            ?>
"><a href="https://apigee.com/providers" target="_blank"><img src="<?php 
            echo $assets_base_url . 'question.png';
            ?>
" style="vertical-align: text-top;" /></a></td>
										</tr>
										<tr>
											<th width="200"><label><?php 
            _wsl_e("Method", 'wordpress-social-login');
            ?>
</label></th>
											<td><select style="width:100px" name="console-method"><option value="GET" <?php 
            if ($method == 'GET') {
                echo 'selected';
            }
            ?>
>GET</option><!-- <option value="POST" <?php 
            if ($method == 'POST') {
                echo 'selected';
            }
            ?>
>POST</option>--></select></td>
										</tr>
										<tr>
											<th width="200"><label><?php 
            _wsl_e("Query", 'wordpress-social-login');
            ?>
</label></th>
											<td><textarea style="width:100%;height:60px;margin-top:6px;" name="console-query"><?php 
            echo htmlentities($query);
            ?>
</textarea></td>
										</tr>
									</table>

									<br />

									<input type="submit" value="<?php 
            _wsl_e("Submit", 'wordpress-social-login');
            ?>
" class="button">
								</form>
							</div>
						</div>

						<?php 
            if ($console) {
                ?>
							<div class="stuffbox">
								<h3>
									<label><?php 
                _wsl_e("API Response", 'wordpress-social-login');
                ?>
</label>
								</h3>
								<div class="inside">
									<textarea rows="25" cols="70" wrap="off" style="width:100%;height:400px;margin-bottom:15px;font-family: monospace;font-size: 12px;"><?php 
                echo htmlentities(print_r($response, true));
                ?>
</textarea>
								</div>
							</div>
						<?php 
                if (0) {
                    ?>
							<div class="stuffbox">
								<h3>
									<label><?php 
                    _wsl_e("Code PHP", 'wordpress-social-login');
                    ?>
</label>
								</h3>
								<div class="inside">
<textarea rows="25" cols="70" wrap="off" style="width:100%;height:210px;margin-bottom:15px;font-family: monospace;font-size: 12px;"
>include_once WORDPRESS_SOCIAL_LOGIN_ABS_PATH . 'hybridauth/Hybrid/Auth.php';

/*!
	Important

	Direct access to providers apis is newly introduced into WSL and we are still experimenting, so they may change in future releases.
*/

try
{
    $<?php 
                    echo strtolower($adapter->providerId);
                    ?>
 = Hybrid_Auth::getAdapter( '<?php 
                    echo htmlentities($provider_id);
                    ?>
' );

<?php 
                    if ($method == 'GET') {
                        ?>
    $response = $<?php 
                        echo strtolower($adapter->providerId);
                        ?>
->api()->get( '<?php 
                        echo htmlentities($path . ($query ? '?' . $query : ''));
                        ?>
' );
<?php 
                    } else {
                        ?>
    $response = $<?php 
                        echo strtolower($adapter->providerId);
                        ?>
->api()->post( '<?php 
                        echo htmlentities($path);
                        ?>
', (array) $query );
<?php 
                    }
                    ?>
}
catch( Exception $e )
{
    echo "Ooophs, we got an error: " . $e->getMessage();
}</textarea>
								</div>
							</div>
							<div class="stuffbox">
								<h3>
									<label><?php 
                    _wsl_e("Connected adapter debug", 'wordpress-social-login');
                    ?>
</label>
								</h3>
								<div class="inside">
									<textarea rows="25" cols="70" wrap="off" style="width:100%;height:400px;margin-bottom:15px;font-family: monospace;font-size: 12px;"><?php 
                    echo htmlentities(print_r($adapter, true));
                    ?>
</textarea>
								</div>
							</div>
							<div class="stuffbox">
								<h3>
									<label><?php 
                    _wsl_e("PHP Session", 'wordpress-social-login');
                    ?>
</label>
								</h3>
								<div class="inside">
									<textarea rows="25" cols="70" wrap="off" style="width:100%;height:350px;margin-bottom:15px;font-family: monospace;font-size: 12px;"><?php 
                    echo htmlentities(print_r($_SESSION, true));
                    ?>
</textarea>
								</div>
							</div>
						<?php 
                }
                ?>
						<?php 
            }
            ?>
					<?php 
        }
        ?>

					<?php 
        if (!$console) {
            ?>
						<div class="stuffbox">
							<h3>
								<label><?php 
            _wsl_e("Connected user social profile", 'wordpress-social-login');
            ?>
</label>
							</h3>
							<div class="inside">
								<table class="wp-list-table widefat">
									<?php 
            $user_profile = (array) $user_profile;
            foreach ($ha_profile_fields as $item) {
                $item['field'] = $item['field'];
                ?>
											<tr>
												<th width="200">
													<label><?php 
                echo $item['label'];
                ?>
</label>
												</th>
												<td>
													<?php 
                if (isset($user_profile[$item['field']]) && $user_profile[$item['field']]) {
                    $field_value = $user_profile[$item['field']];
                    if (in_array(strtolower($item['field']), array('profileurl', 'websiteurl', 'email'))) {
                        ?>
																	<a href="<?php 
                        if ($item['field'] == 'email') {
                            echo 'mailto:';
                        }
                        echo $field_value;
                        ?>
" target="_blank"><?php 
                        echo $field_value;
                        ?>
</a>
																<?php 
                    } elseif (strtolower($item['field']) == 'photourl') {
                        ?>
																	<a href="<?php 
                        echo $field_value;
                        ?>
" target="_blank"><img width="36" height="36" align="left" src="<?php 
                        echo $field_value;
                        ?>
" style="margin-right: 5px;" > <?php 
                        echo $field_value;
                        ?>
</a>
																<?php 
                    } else {
                        echo $field_value;
                    }
                }
                ?>
												</td>
											</tr>
										<?php 
            }
            ?>
								</table>
							</div>
						</div>
					<?php 
        }
        ?>
				<?php 
    }
    ?>
			</td>
			<td width="10"></td>
			<td width="400">
				<div class="postbox">
					<div class="inside">
						<h3><?php 
    _wsl_e("Authentication Playground", 'wordpress-social-login');
    ?>
</h3>

						<div style="padding:0 20px;">
							<p>
								<?php 
    _wsl_e('Authentication Playground will let you authenticate with the enabled social networks without creating any new user account', 'wordpress-social-login');
    ?>
.
							</p>
							<p>
								<?php 
    _wsl_e('This tool will also give you a direct access to social networks apis via a lightweight console', 'wordpress-social-login');
    ?>
.
							</p>
						</div>
					</div>
				</div>

				</style>
				<div class="postbox">
					<div class="inside">
						<div style="padding:0 20px;">
							<p>
								<?php 
    _wsl_e("Connect with", 'wordpress-social-login');
    ?>
:
							</p>

							<div style="width: 380px; padding: 10px; border: 1px solid #ddd; background-color: #fff;">
								<?php 
    do_action('wordpress_social_login', array('mode' => 'test', 'caption' => ''));
    ?>
							</div>
						</div>
					</div>
				</div>
			</td>
		</tr>
	</table>
</div>
<?php 
    // HOOKABLE:
    do_action("wsl_component_authtest_end");
}
function wsl_component_buddypress_notfound()
{
    // HOOKABLE:
    do_action("wsl_component_buddypress_notfound_start");
    ?>
 
<style>
#wsl_div_warn { 
	padding: 10px;  
	border: 1px solid #ddd; 
	background-color: #fff; 
	
	width: 55%;
	margin: 0px auto;
	margin-top:30px;
}
</style>
<div id="wsl_div_warn">
	<h3 style="margin:0px;"><?php 
    _wsl_e("BuddyPress plugin not found!", 'wordpress-social-login');
    ?>
</h3> 

	<hr />

	<p>
		<?php 
    _wsl_e('<a href="https://buddypress.org/" target="_blank">BuddyPress</a> was not found on your website. The plugin is be either not installed or disabled', 'wordpress-social-login');
    ?>
 .
	</p>

	<p>
		<?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');
    ?>
.
	</p>

	<hr />

	<div>
		<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>
		<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>
	</div> 
</div>
<?php 
    // HOOKABLE:
    do_action("wsl_component_buddypress_notfound_end");
}
function wsl_component_users_list()
{
    // HOOKABLE:
    do_action("wsl_component_users_list_start");
    global $wpdb;
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/16x16/';
    $sql = "SELECT meta_value, user_id FROM `{$wpdb->prefix}usermeta` where meta_key = 'wsl_user'";
    $rs1 = $wpdb->get_results($sql);
    ?>
<div style="margin-top:20px;">
	<table cellspacing="0" class="wp-list-table widefat fixed users">
		<thead>
			<tr> 
				<th width="100"><span><?php 
    _wsl_e("Providers", 'wordpress-social-login');
    ?>
</span></th>  
				<th><span><?php 
    _wsl_e("Username", 'wordpress-social-login');
    ?>
</span></th> 
				<th><span><?php 
    _wsl_e("Full Name", 'wordpress-social-login');
    ?>
</span></th> 
				<th><span><?php 
    _wsl_e("E-mail", 'wordpress-social-login');
    ?>
</span></th> 
				<th><span><?php 
    _wsl_e("Profile URL", 'wordpress-social-login');
    ?>
</span></th> 
				<th width="60"><span><?php 
    _wsl_e("Contacts", 'wordpress-social-login');
    ?>
</span></th> 
				<th width="140"><span><?php 
    _wsl_e("Actions", 'wordpress-social-login');
    ?>
</span></th>
			</tr>
		</thead> 
		<tfoot>
			<tr> 
				<th width="100"><span><?php 
    _wsl_e("Providers", 'wordpress-social-login');
    ?>
</span></th>  
				<th><span><?php 
    _wsl_e("Username", 'wordpress-social-login');
    ?>
</span></th> 
				<th><span><?php 
    _wsl_e("Full Name", 'wordpress-social-login');
    ?>
</span></th> 
				<th><span><?php 
    _wsl_e("E-mail", 'wordpress-social-login');
    ?>
</span></th> 
				<th><span><?php 
    _wsl_e("Profile URL", 'wordpress-social-login');
    ?>
</span></th> 
				<th><span><?php 
    _wsl_e("Contacts", 'wordpress-social-login');
    ?>
</span></th>
				<th><span><?php 
    _wsl_e("Actions", 'wordpress-social-login');
    ?>
</span></th>
			</tr>
		</tfoot> 
		<tbody data-wp-lists="list:user" id="the-list">
			<?php 
    // have users?
    if (!$rs1) {
        ?>
						<tr class="no-items"><td colspan="6" class="colspanchange"><?php 
        _wsl_e("No users found", 'wordpress-social-login');
        ?>
.</td></tr>
					<?php 
    } else {
        $i = 0;
        foreach ($rs1 as $items) {
            $provider = $items->meta_value;
            $user_id = $items->user_id;
            ?>
					<tr class="<?php 
            if (++$i % 2) {
                echo "alternate";
            }
            ?>
 tr-contacts"> 
						<td>
							<img src="<?php 
            echo $assets_base_url . strtolower($provider) . '.png';
            ?>
" style="vertical-align:top;width:16px;height:16px;" /> <?php 
            echo $provider;
            ?>
							<?php 
            # linked accounts
            $linked_accounts = wsl_get_user_linked_account_by_user_id($user_id);
            foreach ($linked_accounts as $link) {
                if ($link->provider != $provider) {
                    ?>
 
											<br />
											<img src="<?php 
                    echo $assets_base_url . strtolower($link->provider) . '.png';
                    ?>
" style="vertical-align:top;width:16px;height:16px;" /> <?php 
                    echo $link->provider;
                    ?>
										<?php 
                }
            }
            ?>
 
						</td> 
						<td>
							<?php 
            $wsl_user_image = wsl_get_user_by_meta_key_and_user_id("wsl_user_image", $user_id);
            if ($wsl_user_image) {
                ?>
								<img width="32" height="32" class="avatar avatar-32 photo" src="<?php 
                echo $wsl_user_image;
                ?>
" > 
							<?php 
            } else {
                ?>
								<img width="32" height="32" class="avatar avatar-32 photo" src="http://1.gravatar.com/avatar/d4ed6debc848ece02976aba03e450d60?s=32" > 
							<?php 
            }
            ?>
							<strong><a href="user-edit.php?user_id=<?php 
            echo $user_id;
            ?>
"><?php 
            echo wsl_get_user_by_meta_key_and_user_id("nickname", $user_id);
            ?>
</a></strong>
							<br>
						</td>
						<td><?php 
            echo wsl_get_user_by_meta_key_and_user_id("last_name", $user_id);
            ?>
 <?php 
            echo wsl_get_user_by_meta_key_and_user_id("first_name", $user_id);
            ?>
</td>
						<td>
							<?php 
            $user_wsl_email = wsl_get_user_data_by_user_id("user_wsl_email", $user_id);
            if ($user_wsl_email) {
                ?>
								<?php 
                if (!strstr($user_wsl_email, "@example.com")) {
                    ?>
									<a href="mailto:<?php 
                    echo $user_wsl_email;
                    ?>
"><?php 
                    echo $user_wsl_email;
                    ?>
</a>
								<?php 
                } else {
                    ?>
									-
								<?php 
                }
                ?>
							<?php 
            }
            ?>
						</td>
						<td>
							<?php 
            $user_url = wsl_get_user_data_by_user_id("user_url", $user_id);
            if ($user_url) {
                ?>
 
								<a href="<?php 
                echo $user_url;
                ?>
" target="_blank"><?php 
                echo str_ireplace(array("http://www.", "https://www.", "http://", "https://"), array('', '', '', '', ''), $user_url);
                ?>
</a>
							<?php 
            } else {
                ?>
								-
							<?php 
            }
            ?>
						</td> 
						<td align="center">
							<?php 
            $sql = "SELECT count( * ) as counts FROM `{$wpdb->prefix}wsluserscontacts` where user_id = '{$user_id}'";
            $rs = $wpdb->get_results($sql);
            if ($rs && $rs[0]->counts) {
                echo '<b style="color:#CB4B16;">' . $rs[0]->counts . '</b>';
            } else {
                echo "0";
            }
            ?>
						</td> 
						<td>
							<a class="button button-secondary" href="options-general.php?page=wordpress-social-login&wslp=users&uid=<?php 
            echo $user_id;
            ?>
">Profile</a>
							<a class="button button-secondary" href="options-general.php?page=wordpress-social-login&wslp=contacts&uid=<?php 
            echo $user_id;
            ?>
">Contacts</a>
						</td> 
					</tr> 
			<?php 
        }
    }
    // have users?
    ?>
 
		</tbody>
	</table> 
</div>
<?php 
    // HOOKABLE:
    do_action("wsl_component_users_list_end");
}
function wsl_component_users_list()
{
    // HOOKABLE:
    do_action("wsl_component_users_list_start");
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/16x16/';
    add_thickbox();
    wsl_component_users_delete_social_profiles();
    $actions = array('edit_details' => '<a class="button button-secondary thickbox" href="' . admin_url('users.php?TB_iframe=true&width=1050&height=550') . '">' . _wsl__('View all your website users', 'wordpress-social-login') . '</a>');
    // HOOKABLE:
    $actions = apply_filters('wsl_component_users_list_alter_actions_list', $actions);
    ?>
<div style="padding: 15px; margin-bottom: 8px; border: 1px solid #ddd; background-color: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);">
	<p style="float: <?php 
    if (is_rtl()) {
        echo 'left';
    } else {
        echo 'right';
    }
    ?>
; margin: -5px;">
		<?php 
    echo implode(' ', $actions);
    ?>
	</p>

	<!--
	Postponed to future versions

		<form method="post">
			<select name="provider" style="vertical-align: unset;">
				<option value=""><?php 
    _wsl_e("Provider", 'wordpress-social-login');
    ?>
</option>
			</select>
			<input type="text" value="" name="username" placeholder="<?php 
    _wsl_e("Username", 'wordpress-social-login');
    ?>
" style="height: 28px;">
			<input type="submit" value="Filter" class="button">
		</form>
	-->

	<?php 
    _wsl_e("This screen only list the users who have connected through WordPress Social Login", 'wordpress-social-login');
    ?>
.
</div>
<?php 
    $pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 1;
    $limit = 25;
    // number of rows in page
    $offset = ($pagenum - 1) * $limit;
    $total = wsl_get_stored_hybridauth_user_profiles_count();
    $num_of_pages = ceil($total / $limit);
    $users_list = wsl_get_stored_hybridauth_user_profiles_grouped_by_user_id($offset, $limit);
    ?>
<table cellspacing="0" class="wp-list-table widefat fixed users">
	<thead>
		<tr>
			<th width="100"><span><?php 
    _wsl_e("Providers", 'wordpress-social-login');
    ?>
</span></th>
			<th><span><?php 
    _wsl_e("Username", 'wordpress-social-login');
    ?>
</span></th>
			<th><span><?php 
    _wsl_e("Full Name", 'wordpress-social-login');
    ?>
</span></th>
			<th><span><?php 
    _wsl_e("E-mail", 'wordpress-social-login');
    ?>
</span></th>
			<th><span><?php 
    _wsl_e("Profile URL", 'wordpress-social-login');
    ?>
</span></th>
			<th width="80"><span><?php 
    _wsl_e("Contacts", 'wordpress-social-login');
    ?>
</span></th>
			<th width="55"><span><?php 
    _wsl_e("User ID", 'wordpress-social-login');
    ?>
</span></th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<th width="100"><span><?php 
    _wsl_e("Providers", 'wordpress-social-login');
    ?>
</span></th>
			<th><span><?php 
    _wsl_e("Username", 'wordpress-social-login');
    ?>
</span></th>
			<th><span><?php 
    _wsl_e("Full Name", 'wordpress-social-login');
    ?>
</span></th>
			<th><span><?php 
    _wsl_e("E-mail", 'wordpress-social-login');
    ?>
</span></th>
			<th><span><?php 
    _wsl_e("Profile URL", 'wordpress-social-login');
    ?>
</span></th>
			<th width="80"><span><?php 
    _wsl_e("Contacts", 'wordpress-social-login');
    ?>
</span></th>
			<th width="55"><span><?php 
    _wsl_e("User ID", 'wordpress-social-login');
    ?>
</span></th>
		</tr>
	</tfoot>
	<tbody data-wp-lists="list:user" id="the-list">
		<?php 
    $i = 0;
    // have users?
    if (!$users_list) {
        ?>
					<tr class="no-items"><td colspan="5" class="colspanchange"><?php 
        _wsl_e("No users found", 'wordpress-social-login');
        ?>
.</td></tr>
				<?php 
    } else {
        foreach ($users_list as $items) {
            $user_id = $items->user_id;
            $wsl_user_image = $items->photourl;
            $user_data = get_userdata($user_id);
            if (!$user_data) {
                continue;
            }
            $linked_accounts = wsl_get_stored_hybridauth_user_profiles_by_user_id($user_id);
            ?>
				<tr class="<?php 
            if (++$i % 2) {
                echo "alternate";
            }
            ?>
 tr-contacts">
					<td nowrap>
						<?php 
            foreach ($linked_accounts as $link) {
                ?>
									<img src="<?php 
                echo $assets_base_url . strtolower($link->provider) . '.png';
                ?>
" style="vertical-align:top;width:16px;height:16px;" /> <?php 
                _wsl_e($link->provider, 'wordpress-social-login');
                ?>
<br />
								<?php 
                if ($link->photourl) {
                    $wsl_user_image = $link->photourl;
                }
            }
            ?>
					</td>
					<td class="column-author">
						<?php 
            if ($wsl_user_image) {
                ?>
							<img width="32" height="32" class="avatar avatar-32 photo" src="<?php 
                echo $wsl_user_image;
                ?>
" >
						<?php 
            } else {
                ?>
							<img width="32" height="32" class="avatar avatar-32 photo" src="http://www.gravatar.com/avatar/<?php 
                echo md5(strtolower(trim($user_data->user_email)));
                ?>
" >
						<?php 
            }
            ?>

						<strong><a href="options-general.php?page=wordpress-social-login&wslp=users&uid=<?php 
            echo $user_id;
            ?>
"><?php 
            echo $user_data->user_login;
            ?>
</a></strong>

						<div class="row-actions">
							<span class="view">
								<a href="options-general.php?page=wordpress-social-login&wslp=users&uid=<?php 
            echo $user_id;
            ?>
"><?php 
            _wsl_e("Profiles", 'wordpress-social-login');
            ?>
</a>
								|
							</span>

							<span class="view">
								<a href="options-general.php?page=wordpress-social-login&wslp=contacts&uid=<?php 
            echo $user_id;
            ?>
"><?php 
            _wsl_e("Contacts", 'wordpress-social-login');
            ?>
</a>
								|
							</span>

							<span class="delete">
								<?php 
            $delete_url = wp_nonce_url('options-general.php?page=wordpress-social-login&wslp=users&delete=' . $user_id);
            ?>
								<a style="color: #a00;" href="<?php 
            echo $delete_url;
            ?>
" onClick="return confirmDeleteWSLUser();"><?php 
            _wsl_e("Delete", 'wordpress-social-login');
            ?>
</a>
							</span>
						</div>
					</td>
					<td><?php 
            echo $user_data->display_name;
            ?>
</td>
					<td>
						<?php 
            if (!strstr($user_data->user_email, "@example.com")) {
                ?>
							<a href="mailto:<?php 
                echo $user_data->user_email;
                ?>
"><?php 
                echo $user_data->user_email;
                ?>
</a>
						<?php 
            } else {
                ?>
							-
						<?php 
            }
            ?>
					</td>
					<td>
						<?php 
            if ($user_data->user_url) {
                ?>
							<a href="<?php 
                echo $user_data->user_url;
                ?>
" target="_blank"><?php 
                echo str_ireplace(array("http://www.", "https://www.", "http://", "https://"), array('', '', '', '', ''), $user_data->user_url);
                ?>
</a>
						<?php 
            } else {
                ?>
							-
						<?php 
            }
            ?>
					</td>
					<td align="center">
						<?php 
            $counts = wsl_get_stored_hybridauth_user_contacts_count_by_user_id($user_id);
            if ($counts) {
                ?>
									<a href="options-general.php?page=wordpress-social-login&wslp=contacts&uid=<?php 
                echo $user_id;
                ?>
"><?php 
                echo $counts;
                ?>
</a>
								<?php 
            } else {
                echo "0";
            }
            ?>
					<td align="center"><a class="thickbox" href="<?php 
            echo admin_url('user-edit.php?user_id=' . $user_data->ID . '&TB_iframe=true&width=1150&height=550');
            ?>
"><?php 
            echo $user_data->ID;
            ?>
</a></td>
				</tr>
			<?php 
        }
    }
    ?>
	</tbody>
</table>
<?php 
    $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'prev_text' => __('&laquo;', 'text-domain'), 'next_text' => __('&raquo;', 'text-domain'), 'total' => $num_of_pages, 'current' => $pagenum));
    if ($page_links) {
        echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
    }
    ?>
<script>
	function confirmDeleteWSLUser()
	{
		return confirm( <?php 
    echo json_encode(_wsl__("Are you sure you want to delete the user's social profiles and contacts?\n\nNote: The associated WordPress user won't be deleted.", 'wordpress-social-login'));
    ?>
 );
	}
</script>
<?php 
    // HOOKABLE:
    do_action("wsl_component_users_list_end");
}
function wsl_component_loginwidget_sidebar_custom_integration()
{
    ?>
<div class="postbox">
	<div class="inside">
		<h3><?php 
    _wsl_e("Custom integration", 'wordpress-social-login');
    ?>
</h3>

		<div style="padding:0 20px;">
			<p>
				<?php 
    _wsl_e("If you want to add the widget to another location in your website, you can insert the following code in that location", 'wordpress-social-login');
    ?>
: 
				<pre dir="ltr" style="width: 380px;background-color: #FFFFE0;border:1px solid #E6DB55; border-radius: 3px;padding: 10px;margin-top:15px;margin-left:10px;"> &lt;?php do_action( 'wordpress_social_login' ); ?&gt; </pre> 
				<?php 
    _wsl_e("For posts and pages, you may use this shortcode", 'wordpress-social-login');
    ?>
:
				<div dir="ltr" style="width: 380px;background-color: #EDEFF4;border:1px solid #6B84B4; border-radius: 3px;padding: 10px;margin-top:15px;margin-left:10px;">[wordpress_social_login]</div> 
			</p>

			<p>
				<b><?php 
    _wsl_e('Notes', 'wordpress-social-login');
    ?>
:</b>
				<br />
				1. <?php 
    _wsl_e('WSL Widget will only show up for non connected users', 'wordpress-social-login');
    ?>
.
				<br />
				2. <?php 
    _wsl_e('In case you are using a caching plugin on your website, you might need to empty the cache for any change to take effect', 'wordpress-social-login');
    ?>
.
				<br />
				3. <?php 
    _wsl_e('Adblock Plus users with &ldquo;<a href="https://adblockplus.org/en/features#socialmedia" target="_blank">antisocial filter</a>&rdquo; enabled may not see the providers icons', 'wordpress-social-login');
    ?>
.
			</p>

			<p>
				<b><?php 
    _wsl_e('Tip', 'wordpress-social-login');
    ?>
:</b>
				<br />
				<?php 
    _wsl_e('You can use <a href="http://wordpress.org/extend/plugins/html-javascript-adder/" target="_blank">HTML Javascript Adder</a> plugin in combination with WSL to display the Widget in your website sidebar by using the shortcode [wordpress_social_login]', 'wordpress-social-login');
    ?>
.
			</p>
		</div>
	</div> 
</div> 		
<?php 
}
function wsl_component_components_gallery()
{
    // not for today
    return;
    // HOOKABLE:
    do_action("wsl_component_components_gallery_start");
    add_thickbox();
    ?>
 
<br />

<h2><?php 
    _wsl_e("Other Components available", 'wordpress-social-login');
    ?>
</h2>

<style>
.wsl_addon_div{
	width: 350px; 
	height: 125px; 
	padding: 10px; 
	border: 1px solid #ddd; 
	background-color: #fff;
	float:left;
	margin-bottom: 20px;
	margin-right: 20px;
	
	position: relative;
}
.wsl_addon_div .button-secondary {
    bottom: 8px;
    left: 8px;
    position: absolute; 
}
.wsl_addon_div .button-primary {
    bottom: 8px;
    right: 8px;
    position: absolute;  
}
</style>

<div class="wsl_addon_div">
	<h3 style="margin:0px;"><?php 
    _wsl_e("WordPress Social Login for BuddyPress", 'wordpress-social-login');
    ?>
</h3>
	<hr />
	<p><?php 
    _wsl_e("Make WordPress Social Login compatible with BuddyPress", 'wordpress-social-login');
    ?>
.</p> 
	<p><?php 
    _wsl_e("Widget integration, xProfiles mapping and more", 'wordpress-social-login');
    ?>
.</p> 
	<div>
		<a class="button button-primary thickbox" href="plugin-install.php?tab=plugin-information&plugin=wsl-buddypress&TB_iframe=true"><?php 
    _wsl_e("Install Now", 'wordpress-social-login');
    ?>
</a>
		<a class="button button-secondary" href="http://wordpress.org/extend/plugins/wsl-buddypress/" target="_blank"><?php 
    _wsl_e("Visit plugin site", 'wordpress-social-login');
    ?>
</a> 
	</div>
</div>

<div class="wsl_addon_div">
	<h3 style="margin:0px;"><?php 
    _wsl_e("Build yours", 'wordpress-social-login');
    ?>
</h3>
	<hr />
	<p><?php 
    _wsl_e("Looking to build your own custom <b>WordPress Social Login</b> extenstion or component? Well, it's pretty easy. Just RTFM :)", 'wordpress-social-login');
    ?>
</p>
 
	<div>
		<a class="button button-primary"   href="http://hybridauth.sourceforge.net/wsl/developer.html" target="_blank"><?php 
    _wsl_e("WSL Developer API", 'wordpress-social-login');
    ?>
</a> 
		<a class="button button-secondary" href="https://github.com/hybridauth/WordPress-Social-Login" target="_blank"><?php 
    _wsl_e("WSL on Github", 'wordpress-social-login');
    ?>
</a> 
	</div>
</div>
<?php 
    // HOOKABLE:
    do_action("wsl_component_components_gallery_end");
}
function wsl_component_loginwidget_sidebar()
{
    // HOOKABLE:
    do_action("wsl_component_loginwidget_sidebar_start");
    ?>
<div class="postbox " id="linksubmitdiv"> 
	<div class="inside">
		<div id="submitlink" class="submitbox"> 
			<h3 style="cursor: default;"><?php 
    _wsl_e("What's This?", 'wordpress-social-login');
    ?>
</h3>
			<div id="minor-publishing">  
				<div id="misc-publishing-actions"> 
					<div style="padding:20px;padding-top:0px;">
						<h4 style="cursor: default;border-bottom:1px solid #ccc;font-size: 13px;"><?php 
    _wsl_e("Widget Customization", 'wordpress-social-login');
    ?>
</h4>

						<p style="margin:10px;font-size: 13px;" align="justify"> 
							<?php 
    _wsl_e("On this section you can fully customize <b>WordPress Social Login Widget</b> and define the way you want it to look and behave", 'wordpress-social-login');
    ?>
.
						</p>

						<p style="margin:10px;font-size: 13px;" align="justify"> 
							<?php 
    _wsl_e("<b>WordPress Social Login Widget</b> will be generated into the comments, login and register forms enabling your website vistors and customers to login via social networks", 'wordpress-social-login');
    ?>
.
						</p>

						<p style="margin:10px;"> 
							<?php 
    _wsl_e("If this widget does not show up on your custom theme or you want to add it somewhere else then refer to the next section", 'wordpress-social-login');
    ?>
.
						</p>

						<h4 style="cursor: default;border-bottom:1px solid #ccc;"><?php 
    _wsl_e("Custom integration", 'wordpress-social-login');
    ?>
</h4>

						<p style="margin:10px;"> 
							<?php 
    _wsl_e("If you want to add the social login widget to another location in your theme, you can insert the following code in that location", 'wordpress-social-login');
    ?>
: 
							<pre style="width: 380px;background-color: #FFFFE0;border:1px solid #E6DB55; border-radius: 3px;padding: 10px;margin-top:15px;margin-left:10px;"> &lt;?php do_action( 'wordpress_social_login' ); ?&gt; </pre> 
							<?php 
    _wsl_e("Or, for posts and pages", 'wordpress-social-login');
    ?>
:
							<pre style="width: 380px;background-color: #EDEFF4;border:1px solid #6B84B4; border-radius: 3px;padding: 10px;margin-top:15px;margin-left:10px;">[wordpress_social_login]</pre> 
						</p>

						<p style="margin:10px;"> 
							<?php 
    _wsl_e('<b>[wordpress_social_login]</b> shortcode can be used in combination with <a href="http://wordpress.org/extend/plugins/html-javascript-adder/" target="_blank">HTML Javascript Adder</a> plugin to be add WSL Widget to your website sidebar', 'wordpress-social-login');
    ?>
.
						</p>

						<p style="margin:10px;"> 
							<?php 
    _wsl_e('Also, if you are a developer or designer then you can customize it to your heart\'s content. For more inofmation refer to <b><a href="http://hybridauth.sourceforge.net/wsl/customize.html" target="_blank">User Guide</a></b>', 'wordpress-social-login');
    ?>
.
						</p>

						<h4 style="cursor: default;border-bottom:1px solid #ccc;"><?php 
    _wsl_e("Widget preview", 'wordpress-social-login');
    ?>
</h4>

						<p style="margin:10px;"> 
							<?php 
    _wsl_e("This is a preview of what should be on the comments area", 'wordpress-social-login');
    ?>
.
							<strong><?php 
    _wsl_e("Do not test it here", 'wordpress-social-login');
    ?>
</strong>!
						</p>
 
						<div style="width: 380px;background-color: #FFEBE8;border:1px solid #CC0000; border-radius: 3px;padding: 10px;margin-left:10px;">
							<?php 
    wsl_render_login_form();
    ?>
						</div> 
					</div> 
				</div> 
			</div> 
		</div>
	</div>
</div> 
<?php 
    // HOOKABLE:
    do_action("wsl_component_loginwidget_sidebar_end");
}
function wsl_component_buddypress_setup_profile_mapping()
{
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/';
    $wsl_settings_buddypress_enable_mapping = get_option('wsl_settings_buddypress_enable_mapping');
    $wsl_settings_buddypress_xprofile_map = get_option('wsl_settings_buddypress_xprofile_map');
    # http://hybridauth.sourceforge.net/userguide/Profile_Data_User_Profile.html
    $ha_profile_fields = array(array('field' => 'provider', 'label' => _wsl__("Provider name", 'wordpress-social-login'), 'description' => _wsl__("The the provider or social network name the user used to connected", 'wordpress-social-login')), array('field' => 'identifier', 'label' => _wsl__("Provider user Identifier", 'wordpress-social-login'), 'description' => _wsl__("The Unique user's ID on the connected provider. Depending on the provider, this field can be an number, Email, URL, etc", 'wordpress-social-login')), array('field' => 'profileURL', 'label' => _wsl__("Profile URL", 'wordpress-social-login'), 'description' => _wsl__("Link to the user profile on the provider web site", 'wordpress-social-login')), array('field' => 'webSiteURL', 'label' => _wsl__("Website URL", 'wordpress-social-login'), 'description' => _wsl__("User website, blog or web page", 'wordpress-social-login')), array('field' => 'photoURL', 'label' => _wsl__("Photo URL", 'wordpress-social-login'), 'description' => _wsl__("Link to user picture or avatar on the provider web site", 'wordpress-social-login')), array('field' => 'displayName', 'label' => _wsl__("Display name", 'wordpress-social-login'), 'description' => _wsl__("User Display name. If not provided by social network, WSL will return a concatenation of the user first and last name", 'wordpress-social-login')), array('field' => 'description', 'label' => _wsl__("Description", 'wordpress-social-login'), 'description' => _wsl__("A short about me", 'wordpress-social-login')), array('field' => 'firstName', 'label' => _wsl__("First name", 'wordpress-social-login'), 'description' => _wsl__("User's first name", 'wordpress-social-login')), array('field' => 'lastName', 'label' => _wsl__("Last name", 'wordpress-social-login'), 'description' => _wsl__("User's last name", 'wordpress-social-login')), array('field' => 'gender', 'label' => _wsl__("Gender", 'wordpress-social-login'), 'description' => _wsl__("User's gender. Values are 'female', 'male' or blank", 'wordpress-social-login')), array('field' => 'language', 'label' => _wsl__("Language", 'wordpress-social-login'), 'description' => _wsl__("User's language", 'wordpress-social-login')), array('field' => 'age', 'label' => _wsl__("Age", 'wordpress-social-login'), 'description' => _wsl__("User' age. Note that WSL do not calculate this field. We return it as it was provided", 'wordpress-social-login')), array('field' => 'birthDay', 'label' => _wsl__("Birth day", 'wordpress-social-login'), 'description' => _wsl__("The day in the month in which the person was born. Not to confuse it with 'Birth date'", 'wordpress-social-login')), array('field' => 'birthMonth', 'label' => _wsl__("Birth month", 'wordpress-social-login'), 'description' => _wsl__("The month in which the person was born", 'wordpress-social-login')), array('field' => 'birthYear', 'label' => _wsl__("Birth year", 'wordpress-social-login'), 'description' => _wsl__("The year in which the person was born", 'wordpress-social-login')), array('field' => 'birthDate', 'label' => _wsl__("Birth date", 'wordpress-social-login'), 'description' => _wsl__("Complete birthday in which the person was born. Format: YYYY-MM-DD", 'wordpress-social-login')), array('field' => 'email', 'label' => _wsl__("Email", 'wordpress-social-login'), 'description' => _wsl__("User's email address. Not all of provider grant access to the user email", 'wordpress-social-login')), array('field' => 'phone', 'label' => _wsl__("Phone", 'wordpress-social-login'), 'description' => _wsl__("User's phone number", 'wordpress-social-login')), array('field' => 'address', 'label' => _wsl__("Address", 'wordpress-social-login'), 'description' => _wsl__("User's address", 'wordpress-social-login')), array('field' => 'country', 'label' => _wsl__("Country", 'wordpress-social-login'), 'description' => _wsl__("User's country", 'wordpress-social-login')), array('field' => 'region', 'label' => _wsl__("Region", 'wordpress-social-login'), 'description' => _wsl__("User's state or region", 'wordpress-social-login')), array('field' => 'city', 'label' => _wsl__("City", 'wordpress-social-login'), 'description' => _wsl__("User's city", 'wordpress-social-login')), array('field' => 'zip', 'label' => _wsl__("Zip", 'wordpress-social-login'), 'description' => _wsl__("User's zipcode", 'wordpress-social-login')));
    ?>
<div class="stuffbox">
	<h3>
		<label><?php 
    _wsl_e("Profile mappings", 'wordpress-social-login');
    ?>
</label>
	</h3>
	<div class="inside">
		<p>
			<?php 
    _wsl_e("When <b>Profile mapping</b> is enabled, WSL will try to automatically fill in Buddypress users profiles from their social networks profiles", 'wordpress-social-login');
    ?>
.
		</p>

		<p>
			<b><?php 
    _wsl_e('Notes', 'wordpress-social-login');
    ?>
:</b>
		</p>

		<p class="description">
			1. <?php 
    _wsl_e('<b>Profile mapping</b> will only work for new users. Profile mapping for returning users will implemented in future version of WSL', 'wordpress-social-login');
    ?>
.
			<br />
			2. <?php 
    _wsl_e('Not all the mapped fields will be filled. Some providers and social networks do not give away many information about their users', 'wordpress-social-login');
    ?>
.
			<br />
			3. <?php 
    _wsl_e('WSL can only map <b>Single Fields</b>. Supported fields types are: Multi-line Text Areax, Text Box, URL, Date Selector and Number', 'wordpress-social-login');
    ?>
.
		</p>

		<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">
		  <tr>
			<td width="200" align="right"><strong><?php 
    _wsl_e("Enable profile mapping", 'wordpress-social-login');
    ?>
 :</strong></td>
			<td>
				<select name="wsl_settings_buddypress_enable_mapping" id="wsl_settings_buddypress_enable_mapping" style="width:100px" onChange="toggleMapDiv();">
					<option <?php 
    if ($wsl_settings_buddypress_enable_mapping == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
					<option <?php 
    if ($wsl_settings_buddypress_enable_mapping == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option>
				</select>
			</td>
		  </tr>
		</table>
		<br>
	</div>
</div>

<div id="xprofilemapdiv" class="stuffbox" style="<?php 
    if ($wsl_settings_buddypress_enable_mapping == 2) {
        echo "display:none;";
    }
    ?>
">
	<h3>
		<label><?php 
    _wsl_e("Fields Map", 'wordpress-social-login');
    ?>
</label>
	</h3>

	<div class="inside">
		<p>
			<?php 
    _wsl_e("Here you can create a new map by placing WSL users profiles fields to the appropriate destination fields", 'wordpress-social-login');
    ?>
.
			<?php 
    _wsl_e('The left column shows the available <b>WSL users profiles fields</b>: These select boxes are called <b>source</b> fields', 'wordpress-social-login');
    ?>
.
			<?php 
    _wsl_e('The right column shows the list of <b>Buddypress profiles fields</b>: Those are the <b>destination</b> fields', 'wordpress-social-login');
    ?>
.
			<?php 
    _wsl_e('If you don\'t want to map a particular Buddypress field, then leave the source for that field blank', 'wordpress-social-login');
    ?>
.
		</p>

		<hr />

		<?php 
    if (bp_has_profile()) {
        while (bp_profile_groups()) {
            global $group;
            bp_the_profile_group();
            ?>
						<h4><?php 
            echo sprintf(_wsl__("Fields Group '%s'", 'wordpress-social-login'), $group->name);
            ?>
 :</h4>

						<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">
							<?php 
            while (bp_profile_fields()) {
                global $field;
                bp_the_profile_field();
                ?>
										<tr>
											<td width="270" align="right" valign="top">
												<?php 
                $map = isset($wsl_settings_buddypress_xprofile_map[$field->id]) ? $wsl_settings_buddypress_xprofile_map[$field->id] : 0;
                $can_map_it = true;
                if (!in_array($field->type, array('textarea', 'textbox', 'url', 'datebox', 'number'))) {
                    $can_map_it = false;
                }
                ?>
												<select name="wsl_settings_buddypress_xprofile_map[<?php 
                echo $field->id;
                ?>
]" style="width:255px" id="bb_profile_mapping_selector_<?php 
                echo $field->id;
                ?>
" onChange="showMappingConfirm( <?php 
                echo $field->id;
                ?>
 );" <?php 
                if (!$can_map_it) {
                    echo "disabled";
                }
                ?>
>
													<option value=""></option>
													<?php 
                if ($can_map_it) {
                    foreach ($ha_profile_fields as $item) {
                        ?>
																<option value="<?php 
                        echo $item['field'];
                        ?>
" <?php 
                        if ($item['field'] == $map) {
                            echo "selected";
                        }
                        ?>
 ><?php 
                        echo $item['label'];
                        ?>
</option>
															<?php 
                    }
                }
                ?>
												</select>
											</td>
											<td valign="top" align="center" width="50">
												<img src="<?php 
                echo $assets_base_url;
                ?>
arr_right.png" />
											</td>
											<td valign="top">
												<strong><?php 
                echo $field->name;
                ?>
</strong>
												<?php 
                if (!$can_map_it) {
                    ?>
														<p class="description">
															<?php 
                    _wsl_e("<b>WSL</b> can not map this field. Supported field types are: <em>Multi-line Text Areax, Text Box, URL, Date Selector and Number</em>", 'wordpress-social-login');
                    ?>
.
														</p>
													<?php 
                } else {
                    ?>
														<?php 
                    foreach ($ha_profile_fields as $item) {
                        ?>
															<p class="description bb_profile_mapping_confirm_<?php 
                        echo $field->id;
                        ?>
" style="margin-left:0;<?php 
                        if ($item['field'] != $map) {
                            echo "display:none;";
                        }
                        ?>
" id="bb_profile_mapping_confirm_<?php 
                        echo $field->id;
                        ?>
_<?php 
                        echo $item['field'];
                        ?>
">
																<?php 
                        echo sprintf(_wsl__("WSL <b>%s</b> is mapped to Buddypress <b>%s</b> field", 'wordpress-social-login'), $item['label'], $field->name);
                        ?>
.
																<br />
																<em><b><?php 
                        echo $item['label'];
                        ?>
:</b> <?php 
                        echo $item['description'];
                        ?>
.</em>
															</p>
														<?php 
                    }
                    ?>
													<?php 
                }
                ?>
											</td>
										</tr>
									<?php 
            }
            ?>
						</table>
					<?php 
        }
    }
    ?>
	</div>
</div>
<script>
	function toggleMapDiv(){
		if(typeof jQuery=="undefined"){
			alert( "Error: WordPress Social Login require jQuery to be installed on your wordpress in order to work!" );

			return false;
		}

		var em = jQuery( "#wsl_settings_buddypress_enable_mapping" ).val();

		if( em == 2 ) jQuery( "#xprofilemapdiv" ).hide();
		else jQuery( "#xprofilemapdiv" ).show();
	}

	function showMappingConfirm( field ){
		if(typeof jQuery=="undefined"){
			alert( "Error: WordPress Social Login require jQuery to be installed on your wordpress in order to work!" );

			return false;
		}

		var el = jQuery( "#bb_profile_mapping_selector_" + field ).val();

		jQuery( ".bb_profile_mapping_confirm_" + field ).hide();

		jQuery( "#bb_profile_mapping_confirm_" + field + "_" + el ).show();
	}
</script>
<?php 
}
function wsl_component_users_profile($user_id)
{
    // HOOKABLE:
    do_action("wsl_component_users_profile_start");
    $linked_accounts = wsl_get_user_linked_account_by_user_id($user_id);
    if (!$linked_accounts) {
        _wsl_e("USER DOES NOT EXIST!", 'wordpress-social-login');
        return;
    }
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/16x16/';
    ?>
	<style>
		table td, table th { border: 1px solid #DDDDDD; }
		table th label { font-weight: bold; }
		.form-table th { width:120px; text-align:right; }
	</style>
	<p>
		<a class="button button-secondary" href="user-edit.php?user_id=<?php 
    echo $user_id;
    ?>
">Edit User</a>
		<a class="button button-secondary" href="options-general.php?page=wordpress-social-login&wslp=contacts&uid=<?php 
    echo $user_id;
    ?>
">Show User Contacts List</a>
	</p>
	<hr />
	<?php 
    foreach ($linked_accounts as $link) {
        ?>
			<h3><?php 
        _wsl_e("User Profile", 'wordpress-social-login');
        ?>
 <small><?php 
        echo sprintf(_wsl__("as provided by %s", 'wordpress-social-login'), $link->provider);
        ?>
 </small></h3> 

			<table class="form-table"
				<tr><th><label><?php 
        echo $link->provider;
        ?>
 Identifier </label></th><td><?php 
        echo $link->identifier;
        ?>
 <br /><span class="description">The Unique user's ID. Can be an interger for some providers, Email, URL, etc.</span></td></tr>
				<tr><th><label>Wordpress Identifier </label></th><td><?php 
        echo $user_id;
        ?>
 <br /><span class="description">The Unique user's ID on your website.</span></td></tr>
				<tr><th><label>Profile URL 	</label></th><td><a href="<?php 
        echo $link->profileurl;
        ?>
"><?php 
        echo $link->profileurl;
        ?>
</a> <br /><span class="description">URL link to profile page on the <?php 
        echo $link->provider;
        ?>
 web site.</span></td></tr>
				<tr><th><label>Website URL 	</label></th><td><a href="<?php 
        echo $link->websiteurl;
        ?>
"><?php 
        echo $link->websiteurl;
        ?>
</a> <br /><span class="description">User website, blog, web page, etc.</span></td></tr>
				<tr><th><label>Photo URL 	</label></th><td><a href="<?php 
        echo $link->photourl;
        ?>
"><?php 
        echo $link->photourl;
        ?>
</a> <br /><span class="description">URL link to user photo or avatar.</span></td></tr>
				<tr><th><label>Display name	</label></th><td><?php 
        echo $link->displayname;
        ?>
 <br /><span class="description">User dispaly Name provided by the <?php 
        echo $link->provider;
        ?>
 or a concatenation of first and last name.</span></td></tr>
				<tr><th><label>Description	</label></th><td><?php 
        echo $link->description;
        ?>
				<tr><th><label>First name	</label></th><td><?php 
        echo $link->firstname;
        ?>
				<tr><th><label>Last name 	</label></th><td><?php 
        echo $link->lastname;
        ?>
				<tr><th><label>Gender 		</label></th><td><?php 
        echo $link->gender;
        ?>
				<tr><th><label>Language 	</label></th><td><?php 
        echo $link->language;
        ?>
				<tr><th><label>Age 			</label></th><td><?php 
        echo $link->age;
        ?>
				<tr><th><label>Birth day 	</label></th><td><?php 
        echo $link->birthday;
        ?>
				<tr><th><label>Birth month 	</label></th><td><?php 
        echo $link->birthmonth;
        ?>
				<tr><th><label>Birth year 	</label></th><td><?php 
        echo $link->birthyear;
        ?>
				<tr><th><label>Email 		</label></th><td><?php 
        echo $link->email;
        ?>
				<tr><th><label>Phone 		</label></th><td><?php 
        echo $link->phone;
        ?>
				<tr><th><label>Address 		</label></th><td><?php 
        echo $link->address;
        ?>
				<tr><th><label>Country 		</label></th><td><?php 
        echo $link->country;
        ?>
				<tr><th><label>Region 		</label></th><td><?php 
        echo $link->region;
        ?>
				<tr><th><label>City 		</label></th><td><?php 
        echo $link->city;
        ?>
				<tr><th><label>Zip 			</label></th><td><?php 
        echo $link->zip;
        ?>
				</tr>
			</table>
		<?php 
    }
    // HOOKABLE:
    do_action("wsl_component_users_profile_end");
}
Ejemplo n.º 27
0
function wsl_component_diagnostics()
{
    // HOOKABLE:
    do_action("wsl_component_diagnostics_start");
    ?>
<div style="margin-left:20px;">
	<form method="post" id="wsl_setup_form" action="options.php">  
		<?php 
    settings_fields('wsl-settings-group-development');
    ?>

		<h3><?php 
    _wsl_e("Requirements test", 'wordpress-social-login');
    ?>
</h3> 

		<p style="margin-left:25px;font-size: 14px;"> 
			<?php 
    _wsl_e('In order for <b>WordPress Social Login</b> to work properly, your server should meet certain requirements. These "requirements" <br />and "services" are usually offered by default by most "modern" web hosting providers, however some complications may <br />occur with <b>shared hosting</b> and, or <b>custom wordpress installations</b>', 'wordpress-social-login');
    ?>
. 
		</p>
		<p style="margin-left:25px;font-size: 14px;"> 
			<?php 
    _wsl_e("The minimum server requirements are", 'wordpress-social-login');
    ?>
:
		</p>
		<ul style="margin-left:60px;">
			<li><?php 
    _wsl_e("PHP >= 5.2.0 installed", 'wordpress-social-login');
    ?>
</li> 
			<li><?php 
    _wsl_e("WSL Endpoint URLs reachable", 'wordpress-social-login');
    ?>
</li>
			<li><?php 
    _wsl_e("PHP's default SESSION handling", 'wordpress-social-login');
    ?>
</li>
			<li><?php 
    _wsl_e("PHP/CURL/SSL Extension enabled", 'wordpress-social-login');
    ?>
</li> 
			<li><?php 
    _wsl_e("PHP/JSON Extension enabled", 'wordpress-social-login');
    ?>
</li> 
			<li><?php 
    _wsl_e("PHP/REGISTER_GLOBALS Off", 'wordpress-social-login');
    ?>
</li> 
			<li><?php 
    _wsl_e("jQuery installed on WordPress backoffice", 'wordpress-social-login');
    ?>
</li> 
		</ul>
		<p style="margin-left:25px;margin-top:25px;"> 
			<?php 
    _wsl_e("You can run the <b>WordPress Social Login Requirements Test</b> by clicking the button bellow", 'wordpress-social-login');
    ?>
:
			
			<br />
			<br />
			<a class="button-primary" href='<?php 
    echo WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL;
    ?>
/services/diagnostics.php' target='_blank'><?php 
    _wsl_e("Run the plugin requirements test", 'wordpress-social-login');
    ?>
</a> 
			<a class="button-primary" href='<?php 
    echo WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL;
    ?>
/services/siteinfo.php' target='_blank'><?php 
    _wsl_e("Website Information", 'wordpress-social-login');
    ?>
</a>.
		</p> 

		<br />
		<hr />

		<h3><?php 
    _wsl_e("Development mode", 'wordpress-social-login');
    ?>
</h3> 

		<p style="margin-left:25px;"> 
			<?php 
    _wsl_e('By enabling the development mode, this plugin will try generate and display a technical reports when something goes wrong. <br />This report can help your figure out the root of any issues you may runs into, or you can also send it to the plugin developer. <br />Its recommend to set the Development mode to <b style="color:red">Disabled</b> on production.', 'wordpress-social-login');
    ?>

			<br />
			<br />
			<select name="wsl_settings_development_mode_enabled">
				<option <?php 
    if (get_option('wsl_settings_development_mode_enabled')) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Enabled", 'wordpress-social-login');
    ?>
</option>
				<option <?php 
    if (!get_option('wsl_settings_development_mode_enabled')) {
        echo "selected";
    }
    ?>
 value="0"><?php 
    _wsl_e("Disabled", 'wordpress-social-login');
    ?>
</option> 
			</select>
			<input type="submit" class="button-primary" value="<?php 
    _wsl_e("Save Settings", 'wordpress-social-login');
    ?>
" />
		</p>
	</form>
</div>
<?php 
    // HOOKABLE:
    do_action("wsl_component_diagnostics_end");
}
/**
* Renders wsl localization note
*/
function wsl_admin_help_us_localize_note()
{
    return;
    // nothing, until I decide otherwise..
    $assets_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/';
    ?>
		<div id="l10n-footer">
			<br /><br />
			<img src="<?php 
    echo $assets_url;
    ?>
flags.png">
			<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>
		</div>
	<?php 
}
function wsl_component_loginwidget_setup_custom_css()
{
    ?>
<style>
	.com { color: #6c7c7c; }
	.lit { color: #195f91; }
	.pun, .opn, .clo { color: #93a1a1; }
	.fun { color: #dc322f; }
	.str, .atv { color: #D14; }
	.kwd, .prettyprint .tag { color: #1e347b; }
	.typ, .atn, .dec, .var { color: teal; }
	.pln { color: #48484c; }
	.prettyprint {
	  padding: 8px;
	  background-color: #f7f7f9;
	  border: 1px solid #e1e1e8;
	}
	.prettyprint.linenums {
	  -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
		 -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
			  box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
	}
	ol.linenums {
	  margin: 0 0 0 33px; /* IE indents via margin-left */
	}
	ol.linenums li {
	  padding-left: 12px;
	  color: #bebec5;
	  text-shadow: 0 1px 0 #fff;
	  margin-bottom: 0;
	}
	.prettyprint code {
		background-color: #ffd88f;
		border-radius: 4px;
		color: #c7254e;
		font-size: 90%;
		padding: 2px 4px;
		text-shadow: 0 1px 0 #ffcf75;
	}
</style>
<div class="stuffbox">
	<h3>
		<label><?php 
    _wsl_e("Custom CSS", 'wordpress-social-login');
    ?>
</label>
	</h3>
	<div class="inside"> 
		<p>
			<?php 
    _wsl_e("To customize the default widget styles you can either: change the css in the <b>text area</b> bellow or add it to your website <b>theme</b> files", 'wordpress-social-login');
    ?>
. 
		</p>

		<textarea style="width:100%;height:120px;margin-top:6px;" name="wsl_settings_authentication_widget_css" dir="ltr"><?php 
    echo get_option('wsl_settings_authentication_widget_css');
    ?>
</textarea>

		<br />

		<p>
			<?php 
    _wsl_e("The basic widget markup is the following", 'wordpress-social-login');
    ?>
:
		</p>

		<pre class="prettyprint linenums" dir="ltr"><ol class="linenums"><li class="L0"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"</span><code><span class="atv">wp-social-login-widget</span></code><span class="atv">"</span><span class="tag">&gt;</span></li><li class="L1"><span class="pln">&nbsp;</span></li><li class="L2"><span class="pln">    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"</span><code><span class="atv">wp-social-login-connect-with</span></code><span class="atv">"</span><span class="tag">&gt;</span><span class="pln">{connect_with_caption}</span><span class="tag">&lt;/div&gt;</span></li><li class="L3"><span class="pln">&nbsp;</span></li><li class="L4"><span class="pln">    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"</span><code><span class="atv">wp-social-login-provider-list</span></code><span class="atv">"</span><span class="tag">&gt;</span></li><li class="L5"><span class="pln">    </span></li><li class="L6"><span class="pln">        </span><span class="tag">&lt;a</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"</span><code><span class="atv">wp-social-login-provider wp-social-login-provider-facebook</span></code><span class="atv">"</span><span class="tag">&gt;</span></li><li class="L7"><span class="pln">            </span><span class="tag">&lt;img</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"{provider_icon_facebook}"</span><span class="pln"> </span><span class="tag">/&gt;</span></li><li class="L8"><span class="pln">        </span><span class="tag">&lt;/a&gt;</span></li><li class="L9"><span class="pln">&nbsp;</span></li><li class="L0"><span class="pln">        </span><span class="tag">&lt;a</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"</span><code><span class="atv">wp-social-login-provider wp-social-login-provider-google</span></code><span class="atv">"</span><span class="tag">&gt;</span></li><li class="L1"><span class="pln">            </span><span class="tag">&lt;img</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"{provider_icon_google}"</span><span class="pln"> </span><span class="tag">/&gt;</span></li><li class="L2"><span class="pln">        </span><span class="tag">&lt;/a&gt;</span></li><li class="L3"><span class="pln">&nbsp;</span></li><li class="L4"><span class="pln">        </span><span class="tag">&lt;a</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"</span><code><span class="atv">wp-social-login-provider wp-social-login-provider-twitter</span></code><span class="atv">"</span><span class="tag">&gt;</span></li><li class="L5"><span class="pln">            </span><span class="tag">&lt;img</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"{provider_icon_twitter}"</span><span class="pln"> </span><span class="tag">/&gt;</span></li><li class="L6"><span class="pln">        </span><span class="tag">&lt;/a&gt;</span></li><li class="L7"><span class="pln">&nbsp;</span></li><li class="L8"><span class="pln">    </span><span class="tag">&lt;/div&gt;</span><span class="pln"> </span><span class="com">&lt;!-- / div.wp-social-login-connect-options --&gt;</span></li><li class="L9"><span class="pln">&nbsp;</span></li><li class="L0"><span class="pln">    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"</span><code><span class="atv">wp-social-login-widget-clearing</span></code><span class="atv">"</span><span class="tag">&gt;&lt;/div&gt;</span></li><li class="L1"><span class="pln">&nbsp;</span></li><li class="L2"><span class="tag">&lt;/div&gt;</span><span class="pln"> </span><span class="com">&lt;!-- / div.wp-social-login-widget --&gt;</span></li></ol></pre>

	</div>
</div>
<?php 
}
/**
* This should be reworked somehow.. the code has become spaghettis
*/
function wsl_component_networks_setup()
{
    // HOOKABLE:
    do_action("wsl_component_networks_setup_start");
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/16x16/';
    $assets_setup_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/setup/';
    // save settings?
    if (isset($_REQUEST["enable"]) && $_REQUEST["enable"]) {
        $provider_id = $_REQUEST["enable"];
        update_option('wsl_settings_' . $provider_id . '_enabled', 1);
    }
    ?>
<script>
	function toggleproviderkeys(idp)
	{
		if(typeof jQuery=="undefined")
		{
			alert( "Error: WordPress Social Login require jQuery to be installed on your wordpress in order to work!" );

			return;
		}

		if(jQuery('#wsl_settings_' + idp + '_enabled').val()==1)
		{
			jQuery('.wsl_tr_settings_' + idp).show();
		}
		else
		{
			jQuery('.wsl_tr_settings_' + idp).hide();
			jQuery('.wsl_div_settings_help_' + idp).hide();
		}

		return false;
	}

	function toggleproviderhelp(idp)
	{
		if(typeof jQuery=="undefined")
		{
			alert( "Error: WordPress Social Login require jQuery to be installed on your wordpress in order to work!" );

			return false;
		}

		jQuery('.wsl_div_settings_help_' + idp).toggle();

		return false;
	}
</script>
<?php 
    foreach ($WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG as $item) {
        $provider_id = isset($item["provider_id"]) ? $item["provider_id"] : '';
        $provider_name = isset($item["provider_name"]) ? $item["provider_name"] : '';
        $require_client_id = isset($item["require_client_id"]) ? $item["require_client_id"] : '';
        $require_api_key = isset($item["require_api_key"]) ? $item["require_api_key"] : '';
        $default_api_scope = isset($item["default_api_scope"]) ? $item["default_api_scope"] : '';
        $provide_email = isset($item["provide_email"]) ? $item["provide_email"] : '';
        $provider_new_app_link = isset($item["new_app_link"]) ? $item["new_app_link"] : '';
        $provider_userguide_section = isset($item["userguide_section"]) ? $item["userguide_section"] : '';
        $provider_callback_url = "";
        if (!(isset($item["default_network"]) && $item["default_network"] || get_option('wsl_settings_' . $provider_id . '_enabled'))) {
            continue;
        }
        // default endpoint_url
        $endpoint_url = WORDPRESS_SOCIAL_LOGIN_HYBRIDAUTH_ENDPOINT_URL;
        if (isset($item["callback"]) && $item["callback"]) {
            $provider_callback_url = '<span style="color:green">' . $endpoint_url . '?hauth.done=' . $provider_id . '</span>';
        }
        if (isset($item["custom_callback"]) && $item["custom_callback"]) {
            $provider_callback_url = '<span style="color:green">' . $endpoint_url . 'endpoints/' . strtolower($provider_id) . '.php</span>';
        }
        $setupsteps = 0;
        ?>
		<a name="setup<?php 
        echo strtolower($provider_id);
        ?>
"></a>
		<div class="stuffbox" id="namediv">
			<h3>
				<label class="wp-neworks-label">
					<img alt="<?php 
        echo $provider_name;
        ?>
" title="<?php 
        echo $provider_name;
        ?>
" src="<?php 
        echo $assets_base_url . strtolower($provider_id) . '.png';
        ?>
" style="vertical-align: top;width:16px;height:16px;" /> <?php 
        _wsl_e($provider_name, 'wordpress-social-login');
        ?>
				</label>
			</h3>
			<div class="inside">
				<table class="form-table editcomment">
					<tbody>
						<tr>
							<td style="width:125px"><?php 
        _wsl_e("Enabled", 'wordpress-social-login');
        ?>
:</td>
							<td>
								<select
									name="<?php 
        echo 'wsl_settings_' . $provider_id . '_enabled';
        ?>
"
									id="<?php 
        echo 'wsl_settings_' . $provider_id . '_enabled';
        ?>
"
									onChange="toggleproviderkeys('<?php 
        echo $provider_id;
        ?>
')"
								>
									<option value="1" <?php 
        if (get_option('wsl_settings_' . $provider_id . '_enabled')) {
            echo "selected";
        }
        ?>
 ><?php 
        _wsl_e("Yes", 'wordpress-social-login');
        ?>
</option>
									<option value="0" <?php 
        if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
            echo "selected";
        }
        ?>
 ><?php 
        _wsl_e("No", 'wordpress-social-login');
        ?>
</option>
								</select>
							</td>
							<td style="width:160px">&nbsp;</td>
						</tr>

						<?php 
        if ($provider_new_app_link) {
            ?>
							<?php 
            if ($require_client_id) {
                // key or id ?
                ?>
								<tr valign="top" <?php 
                if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
                    echo 'style="display:none"';
                }
                ?>
 class="wsl_tr_settings_<?php 
                echo $provider_id;
                ?>
" >
									<td><?php 
                _wsl_e("Application ID", 'wordpress-social-login');
                ?>
:</td>
									<td><input dir="ltr" type="text" name="<?php 
                echo 'wsl_settings_' . $provider_id . '_app_id';
                ?>
" value="<?php 
                echo get_option('wsl_settings_' . $provider_id . '_app_id');
                ?>
" ></td>
									<td><a href="javascript:void(0)" onClick="toggleproviderhelp('<?php 
                echo $provider_id;
                ?>
')"><?php 
                _wsl_e("Where do I get this info?", 'wordpress-social-login');
                ?>
</a></td>
								</tr>
							<?php 
            } else {
                ?>
								<tr valign="top" <?php 
                if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
                    echo 'style="display:none"';
                }
                ?>
 class="wsl_tr_settings_<?php 
                echo $provider_id;
                ?>
" >
									<td><?php 
                _wsl_e("Application Key", 'wordpress-social-login');
                ?>
:</td>
									<td><input dir="ltr" type="text" name="<?php 
                echo 'wsl_settings_' . $provider_id . '_app_key';
                ?>
" value="<?php 
                echo get_option('wsl_settings_' . $provider_id . '_app_key');
                ?>
" ></td>
									<td><a href="javascript:void(0)" onClick="toggleproviderhelp('<?php 
                echo $provider_id;
                ?>
')"><?php 
                _wsl_e("Where do I get this info?", 'wordpress-social-login');
                ?>
</a></td>
								</tr>
							<?php 
            }
            ?>

							<?php 
            if (!$require_api_key) {
                ?>
								<tr valign="top" <?php 
                if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
                    echo 'style="display:none"';
                }
                ?>
 class="wsl_tr_settings_<?php 
                echo $provider_id;
                ?>
" >
									<td><?php 
                _wsl_e("Application Secret", 'wordpress-social-login');
                ?>
:</td>
									<td><input dir="ltr" type="text" name="<?php 
                echo 'wsl_settings_' . $provider_id . '_app_secret';
                ?>
" value="<?php 
                echo get_option('wsl_settings_' . $provider_id . '_app_secret');
                ?>
" ></td>
									<td><a href="javascript:void(0)" onClick="toggleproviderhelp('<?php 
                echo $provider_id;
                ?>
')"><?php 
                _wsl_e("Where do I get this info?", 'wordpress-social-login');
                ?>
</a></td>
								</tr>
							<?php 
            }
            ?>

							<?php 
            if (get_option('wsl_settings_development_mode_enabled')) {
                ?>
								<?php 
                if ($default_api_scope) {
                    ?>
									<tr valign="top" <?php 
                    if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
                        echo 'style="display:none"';
                    }
                    ?>
 class="wsl_tr_settings_<?php 
                    echo $provider_id;
                    ?>
" >
										<td><?php 
                    _wsl_e("Application Scope", 'wordpress-social-login');
                    ?>
:</td>
										<td><input dir="ltr" type="text" name="<?php 
                    echo 'wsl_settings_' . $provider_id . '_app_scope';
                    ?>
" value="<?php 
                    echo get_option('wsl_settings_' . $provider_id . '_app_scope');
                    ?>
" ></td>
									</tr>
								<?php 
                }
                ?>

								<?php 
                if ($provider_callback_url) {
                    ?>
									<tr valign="top" <?php 
                    if (!get_option('wsl_settings_' . $provider_id . '_enabled')) {
                        echo 'style="display:none"';
                    }
                    ?>
 class="wsl_tr_settings_<?php 
                    echo $provider_id;
                    ?>
" >
										<td><?php 
                    _wsl_e("Callback URL", 'wordpress-social-login');
                    ?>
:</td>
										<td><input dir="ltr" type="text" name="" value="<?php 
                    echo strip_tags($provider_callback_url);
                    ?>
" readonly="readonly"></td>
									</tr>
								<?php 
                }
                ?>
							<?php 
            }
            ?>
						<?php 
        }
        // if require registration
        ?>
					</tbody>
				</table>

				<?php 
        if (get_option('wsl_settings_' . $provider_id . '_enabled')) {
            ?>
					<?php 
            if ($provider_id == "Steam") {
                ?>
						<div class="fade updated">
							<p>
								<b><?php 
                _wsl_e("Notes", 'wordpress-social-login');
                ?>
:</b>
							</p>
							<p>
								      1. <?php 
                echo sprintf(_wsl__("<b>%s</b> do not require an external application, however if the Web API Key is provided, then WSL will be able to get more information about the connected %s users", 'wordpress-social-login'), $provider_name, $provider_name);
                ?>
.
								<br />2. <?php 
                echo sprintf(_wsl__("<b>%s</b> do not provide their user's email address and by default a random email will then be generated for them instead", 'wordpress-social-login'), $provider_name);
                ?>
.

								<?php 
                _wsl_e('To change this behaviour and to force new registered users to provide their emails before they get in, goto <b><a href="options-general.php?page=wordpress-social-login&wslp=bouncer">Bouncer</a></b> and enable <b>Profile Completion</b>', 'wordpress-social-login');
                ?>
.
							</p>
						</div>
					<?php 
            } elseif ($provider_new_app_link && strlen(trim(get_option('wsl_settings_' . $provider_id . '_app_secret'))) == 0) {
                ?>
						<div class="fade error">
							<p>
								<?php 
                echo sprintf(_wsl__('<b>%s</b> requires that you create an external application linking your website to their API. To know how to create this application, click on &ldquo;Where do I get this info?&rdquo; and follow the steps', 'wordpress-social-login'), $provider_name, $provider_name);
                ?>
.
							</p>
						</div>
					<?php 
            } elseif (in_array($provider_id, array("Twitter", "Identica", "Tumblr", "Goodreads", "500px", "Vkontakte", "Gowalla", "Steam"))) {
                ?>
						<div class="fade updated">
							<p>
								<b><?php 
                _wsl_e("Note", 'wordpress-social-login');
                ?>
:</b>

								<?php 
                echo sprintf(_wsl__("<b>%s</b> do not provide their user's email address and by default a random email will then be generated for them instead", 'wordpress-social-login'), $provider_name);
                ?>
.

								<?php 
                _wsl_e('To change this behaviour and to force new registered users to provide their emails before they get in, goto <b><a href="options-general.php?page=wordpress-social-login&wslp=bouncer">Bouncer</a></b> and enable <b>Profile Completion</b>', 'wordpress-social-login');
                ?>
.
							</p>
						</div>
					<?php 
            }
            ?>
				<?php 
        }
        ?>

				<br />
				<div
					class="wsl_div_settings_help_<?php 
        echo $provider_id;
        ?>
"
					style="<?php 
        if (isset($_REQUEST["enable"]) && !isset($_REQUEST["settings-updated"]) && $_REQUEST["enable"] == $provider_id) {
            echo "-";
        }
        // <= lolz
        ?>
display:none;"
				>
					<hr class="wsl" />
					<?php 
        if ($provider_id == "Steam") {
            ?>
					<?php 
        } elseif ($provider_new_app_link) {
            ?>
						<?php 
            _wsl_e('<span style="color:#CB4B16;">Application</span> id and secret (also sometimes referred as <span style="color:#CB4B16;">Consumer</span> key and secret or <span style="color:#CB4B16;">Client</span> id and secret) are what we call an application credentials', 'wordpress-social-login');
            ?>
.

						<?php 
            echo sprintf(_wsl__('This application will link your website <code>%s</code> to <code>%s API</code> and these credentials are needed in order for <b>%s</b> users to access your website', 'wordpress-social-login'), $_SERVER["SERVER_NAME"], $provider_name, $provider_name);
            ?>
.
						<br />

						<?php 
            _wsl_e("These credentials may also differ in format, name and content depending on the social network.", 'wordpress-social-login');
            ?>
						<br />
						<br />

						<?php 
            echo sprintf(_wsl__('To enable authentication with this provider and to register a new <b>%s API Application</b>, follow the steps', 'wordpress-social-login'), $provider_name);
            ?>
						:<br />
					<?php 
        } else {
            ?>
							<p><?php 
            echo sprintf(_wsl__('<b>Done.</b> Nothing more required for <b>%s</b>', 'wordpress-social-login'), $provider_name);
            ?>
.</p>
					<?php 
        }
        ?>
					<div style="margin-left:40px;">
						<?php 
        if ($provider_new_app_link) {
            ?>
							<p><?php 
            echo "<b>" . ++$setupsteps . "</b>.";
            ?>
 <?php 
            echo sprintf(_wsl__('First go to: <a href="%s" target ="_blank">%s</a>', 'wordpress-social-login'), $provider_new_app_link, $provider_new_app_link);
            ?>
</p>

							<?php 
            if ($provider_id == "Google") {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e('On the <b>Dashboard sidebar</b> click on <b>Project</b> then click <em style="color:#0147bb;">&ldquo;Create Project&rdquo;</em>', 'wordpress-social-login');
                ?>
.</p>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Once the project is created. Select that project, then <b>APIs & auth</b> &gt; <b>Consent screen</b> and fill the required information", 'wordpress-social-login');
                ?>
.</p>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e('Then <b>APIs & auth</b> &gt; <b>APIs</b> and enable <em style="color:#0147bb;">&ldquo;Google+ API&rdquo;</em>. If you want to import the user contatcs enable <em style="color:#0147bb;">&ldquo;Contacts API&rdquo;</em> as well', 'wordpress-social-login');
                ?>
.</p>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("After that you will need to create an new application: <b>APIs & auth</b> &gt; <b>Credentials</b> and then click <em style=\"color:#0147bb;\">&ldquo;Create new Client ID&rdquo;</em>", 'wordpress-social-login');
                ?>
.</p>
								</p>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("On the <b>&ldquo;Create Client ID&rdquo;</b> popup", 'wordpress-social-login');
                ?>
 :</p>
								<ul style="margin-left:35px">
									<li><?php 
                _wsl_e('Select <em style="color:#0147bb;">&ldquo;Web application&rdquo;</em> as your application type', 'wordpress-social-login');
                ?>
.</li>
									<li><?php 
                _wsl_e("Put your website domain in the <b>Authorized JavaScript origins</b> field. This should match with the current hostname", 'wordpress-social-login');
                ?>
 <em style="color:#CB4B16;"><?php 
                echo $_SERVER["SERVER_NAME"];
                ?>
</em>.</li>
									<li><?php 
                _wsl_e("Provide this URL as the <b>Authorized redirect URI</b> for your application", 'wordpress-social-login');
                ?>
: <br /><?php 
                echo $provider_callback_url;
                ?>
</li>
								</ul>
							<?php 
            } elseif ($provider_id == "Facebook") {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Select <b>Add a New App</b> from the <b>Apps</b> menu at the top", 'wordpress-social-login');
                ?>
.</p>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Fill out Display Name, Namespace, choose a category and click <b>Create App</b>", 'wordpress-social-login');
                ?>
.</p>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Go to Settings page and click on <b>Add Platform</b>. Choose website and enter in the new screen your website url in <b>App Domains</b> and <b>Site URL</b> fields", 'wordpress-social-login');
                ?>
.
									<?php 
                _wsl_e("They should match with the current hostname", 'wordpress-social-login');
                ?>
 <em style="color:#CB4B16;"><?php 
                echo $_SERVER["SERVER_NAME"];
                ?>
</em>.</p>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Go to the <b>Status & Review</b> page and choose <b>yes</b> where it says <b>Do you want to make this app and all its live features available to the general public?</b>", 'wordpress-social-login');
                ?>
.</p>
							<?php 
            } else {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Create a new application", 'wordpress-social-login');
                ?>
.</p>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Fill out any required fields such as the application name and description", 'wordpress-social-login');
                ?>
.</p>
							<?php 
            }
            ?>

							<?php 
            if ($provider_callback_url && $provider_id != "Google" && $provider_id != "Facebook") {
                ?>
								<p>
									<?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Provide this URL as the <b>Callback URL</b> for your application", 'wordpress-social-login');
                ?>
:
									<br />
									<?php 
                echo $provider_callback_url;
                ?>
								</p>
							<?php 
            }
            ?>

							<?php 
            if ($provider_id == "Live") {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Put your website domain in the <b>Redirect Domain</b> field. This should match with the current hostname", 'wordpress-social-login');
                ?>
 <em style="color:#CB4B16;"><?php 
                echo $_SERVER["SERVER_NAME"];
                ?>
</em>.</p>
							<?php 
            }
            ?>

							<?php 
            if ($provider_id == "LinkedIn") {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e('Choose <b>Live</b> on <b>Live Status</b>.', 'wordpress-social-login');
                ?>
</p>
							<?php 
            }
            ?>

							<?php 
            if ($provider_id == "Google") {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Once you have registered past the created application credentials (Client ID and Secret) into the boxes above", 'wordpress-social-login');
                ?>
.</p>
							<?php 
            } elseif ($provider_id == "Twitter") {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Once you have registered, past the created application credentials (Consumer Key and Secret) into the boxes above", 'wordpress-social-login');
                ?>
.</p>
							<?php 
            } elseif ($provider_id == "Facebook") {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Go back to the <b>Dashboard</b> page and past the created application credentials (APP ID and Secret) into the boxes above", 'wordpress-social-login');
                ?>
.</p>
							<?php 
            } else {
                ?>
								<p><?php 
                echo "<b>" . ++$setupsteps . "</b>.";
                ?>
 <?php 
                _wsl_e("Once you have registered, past the created application credentials into the boxes above", 'wordpress-social-login');
                ?>
.</p>
							<?php 
            }
            ?>

						<?php 
        }
        ?>

						<?php 
        if ($provider_id == "Facebook") {
            ?>
							<table style="text-align: center;margin-bottom:12px;">
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'facebook/1.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'facebook/1.png';
            ?>
"></a></td>
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'facebook/2.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'facebook/2.png';
            ?>
"></a></td>
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'facebook/3.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'facebook/3.png';
            ?>
"></a></td>
							</table>
						<?php 
        }
        ?>

						<?php 
        if ($provider_id == "Google") {
            ?>
							<table style="text-align: center;margin-bottom:12px;">
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'google/1.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'google/1.png';
            ?>
"></a></td>
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'google/2.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'google/2.png';
            ?>
"></a></td>
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'google/3.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'google/3.png';
            ?>
"></a></td>
							</table>
						<?php 
        }
        ?>

						<?php 
        if ($provider_id == "Twitter") {
            ?>
							<table style="text-align: center;margin-bottom:12px;">
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'twitter/1.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'twitter/1.png';
            ?>
"></a></td>
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'twitter/2.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'twitter/2.png';
            ?>
"></a></td>
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'twitter/3.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'twitter/3.png';
            ?>
"></a></td>
							</table>
						<?php 
        }
        ?>

						<?php 
        if ($provider_id == "WordPress") {
            ?>
							<table style="text-align: center;margin-bottom:12px;">
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'wordpress/1.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'wordpress/1.png';
            ?>
"></a></td>
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'wordpress/2.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'wordpress/2.png';
            ?>
"></a></td>
								<td><a class="span4 thumbnail" href="<?php 
            echo $assets_setup_base_url . 'wordpress/3.png';
            ?>
" target="_blank"><img src="<?php 
            echo $assets_setup_base_url . 'wordpress/3.png';
            ?>
"></a></td>
							</table>
						<?php 
        }
        ?>
					</div>

					<?php 
        if ($provider_new_app_link) {
            ?>
						<hr />
						<p>
							<b><?php 
            _wsl_e("And that's it!", 'wordpress-social-login');
            ?>
</b>
							<br />
							<?php 
            echo sprintf(_wsl__('If for some reason you still can\'t manage to create an application for %s, first try to <a href="https://www.google.com/search?q=%s API create application" target="_blank">Google it</a>, then check it on <a href="http://www.youtube.com/results?search_query=%s API create application " target="_blank">Youtube</a>, and if nothing works <a href="options-general.php?page=wordpress-social-login&wslp=help">ask for support</a>', 'wordpress-social-login'), $provider_name, $provider_name, $provider_name);
            ?>
.
						</p>
					<?php 
        }
        ?>
				</div>
			</div>
		</div>
<?php 
    }
    ?>
	<input type="submit" class="button-primary" value="<?php 
    _wsl_e("Save Settings", 'wordpress-social-login');
    ?>
" />
<?php 
    // HOOKABLE:
    do_action("wsl_component_networks_setup_end");
}