当前位置: 首页>>代码示例>>PHP>>正文


PHP Hybrid_Auth::getAdapter方法代码示例

本文整理汇总了PHP中Hybrid_Auth::getAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Auth::getAdapter方法的具体用法?PHP Hybrid_Auth::getAdapter怎么用?PHP Hybrid_Auth::getAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hybrid_Auth的用法示例。


在下文中一共展示了Hybrid_Auth::getAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUser

 /**
  * Check if a provider already connected return user record if available
  *
  * @param Request $request Request instance.
  * @return array|bool User array on success, false on failure.
  */
 public function getUser(Request $request)
 {
     $this->_init($request);
     $idps = $this->hybridAuth->getConnectedProviders();
     foreach ($idps as $provider) {
         $adapter = $this->hybridAuth->getAdapter($provider);
         return $this->_getUser($provider, $adapter);
     }
     return false;
 }
开发者ID:jamiefifty,项目名称:CakePHP-HybridAuth,代码行数:16,代码来源:HybridAuthAuthenticate.php

示例2: oauth_init

/**
 * plugin initialization
 */
function oauth_init()
{
    global $conf, $page, $hybridauth_conf, $template;
    load_language('plugin.lang', OAUTH_PATH);
    $conf['oauth'] = safe_unserialize($conf['oauth']);
    // check config
    if (defined('IN_ADMIN')) {
        if (empty($hybridauth_conf) and strpos(@$_GET['page'], 'plugin-oAuth') === false) {
            $page['warnings'][] = '<a href="' . OAUTH_ADMIN . '">' . l10n('Social Connect: You need to configure the credentials') . '</a>';
        }
        if (!function_exists('curl_init')) {
            $page['warnings'][] = l10n('Social Connect: PHP Curl extension is needed');
        }
    }
    // in case of registration aborded
    if (script_basename() == 'index' and ($oauth_id = pwg_get_session_var('oauth_new_user')) !== null) {
        pwg_unset_session_var('oauth_new_user');
        if ($oauth_id[0] == 'Persona') {
            oauth_assign_template_vars(get_gallery_home_url());
            $template->block_footer_script(null, 'navigator.id.logout();');
        } else {
            require_once OAUTH_PATH . 'include/hybridauth/Hybrid/Auth.php';
            try {
                $hybridauth = new Hybrid_Auth($hybridauth_conf);
                $adapter = $hybridauth->getAdapter($oauth_id[0]);
                $adapter->logout();
            } catch (Exception $e) {
            }
        }
    }
}
开发者ID:lcorbasson,项目名称:Piwigo-Social-Connect,代码行数:34,代码来源:main.inc.php

示例3: getServiceProfile

 /**
  * Gets user profile from service
  *
  * @param string $provider Service provider, like Google, Twitter etc.
  *
  * @return array|boolean
  */
 function getServiceProfile($provider = '')
 {
     $providers = $this->Hybrid_Auth->getConnectedProviders();
     $providerId = ucfirst($provider);
     if (is_array($providers) && in_array($provider, $providers)) {
         /* @var Hybrid_Providers_Google $provider */
         $provider = $this->Hybrid_Auth->getAdapter($providerId);
         $profile = $provider->getUserProfile();
         $array = json_encode($profile);
         return json_decode($array, true);
     } else {
         return false;
     }
 }
开发者ID:govza,项目名称:modx-hybridauth,代码行数:21,代码来源:hybridauth.class.php

示例4: logoutAllProviders

 /**
  * A generic function to logout all connected provider at once
  */
 public static function logoutAllProviders()
 {
     $idps = Hybrid_Auth::getConnectedProviders();
     foreach ($idps as $idp) {
         $adapter = Hybrid_Auth::getAdapter($idp);
         $adapter->logout();
     }
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:11,代码来源:Auth.php

示例5:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="public/css.css" type="text/css">
</head>
<body>  
<table width="90%" border="0" cellpadding="2" cellspacing="2">
  <tr>
    <td valign="top">
		<?php 
include "includes/menu.php";
?>
  
		<fieldset>
			<legend>Post feed to Facebook pages</legend>   
			<?php 
try {
    $adapter = $hybridauth->getAdapter($provider);
    // ask facebook api for the users accounts
    $accounts = $adapter->api()->api('/me/accounts');
    if (!count($accounts["data"])) {
        ?>
						<p>
							NO pages found for the current user! 
						</p>
						<p>
							<b>Note</b>: To be able to post to facebook pages you should:
						</p>
						<ol>
							<li>Add <b>"manage_pages"</b> to the requested scope in the configuration,</li>
							<li>Logout from Facebook provider,</li>
							<li>Re sign-in with Facebook.</li>
						</ol> 
开发者ID:moxymokaya,项目名称:inoERP,代码行数:31,代码来源:facebook_pages.php

示例6: wsl_process_login_get_provider_adapter

/**
* Returns hybriauth idp adapter.
*/
function wsl_process_login_get_provider_adapter($provider)
{
    if (!class_exists('Hybrid_Auth', false)) {
        require_once WORDPRESS_SOCIAL_LOGIN_ABS_PATH . "hybridauth/Hybrid/Auth.php";
    }
    return Hybrid_Auth::getAdapter($provider);
}
开发者ID:NickIvanter,项目名称:wordpress-social-login,代码行数:10,代码来源:wsl.authentication.php

示例7: oauth_logout

/**
 * logout
 */
function oauth_logout($user_id)
{
    global $hybridauth_conf;
    $oauth_id = get_oauth_id($user_id);
    if (!isset($oauth_id)) {
        return;
    }
    list($provider, $identifier) = explode('---', $oauth_id, 2);
    if ($provider != 'Persona') {
        require_once OAUTH_PATH . 'include/hybridauth/Hybrid/Auth.php';
        try {
            $hybridauth = new Hybrid_Auth($hybridauth_conf);
            $adapter = $hybridauth->getAdapter($provider);
            $adapter->logout();
        } catch (Exception $e) {
            $_SESSION['page_errors'][] = l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>', $e->getCode());
        }
    }
}
开发者ID:lcorbasson,项目名称:Piwigo-Social-Connect,代码行数:22,代码来源:public_events.inc.php

示例8: wsl_component_authtest

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 
        }
//.........这里部分代码省略.........
开发者ID:kingafrojoe,项目名称:wordpress-social-login,代码行数:101,代码来源:index.php

示例9: catch

                $ha->redirect(BASE_URL);
            } else {
                $error = "unable to retrieve user profile";
            }
        } else {
            $error = "unable to authenticate";
        }
    } catch (Exception $e) {
        $error = "<b>got an error!</b> " . $e->getMessage();
    }
}
// logout user
if (isset($_GET["logout"]) and $_GET["logout"] == true) {
    try {
        $ha = new Hybrid_Auth(HA_CONFIG);
        $f = $ha->getAdapter("facebook");
        $f->logout();
        $_SESSION = array();
        session_destroy();
        $ha->redirect(BASE_URL);
    } catch (Exception $e) {
        $error = "<b>got an error!</b> " . $e->getMessage();
    }
}
// logged in ? User data
if (isset($_SESSION["user_id"])) {
    $login_status = true;
    $user_id = $_SESSION["user_id"];
    session_write_close();
    $user_data = $Users->find_user_by_id($user_id);
    if (!$user_data) {
开发者ID:samuraisxmali,项目名称:facebook-login-with-hybridauth-example,代码行数:31,代码来源:index.php

示例10: tryProviderSession

 public function tryProviderSession($deniedAs)
 {
     // don't allow if main admin browse front-end or there is already user session
     if (!$deniedAs && $this->getSessionDataAs() || null !== $this->_session_data || !e107::getPref('social_login_active', false)) {
         return $this;
     }
     try {
         // detect all currently connected providers
         $hybrid = e107::getHybridAuth();
         // init the auth class
         $connected = Hybrid_Auth::getConnectedProviders();
     } catch (Exception $e) {
         e107::getMessage()->addError('[' . $e->getCode() . ']' . $e->getMessage(), 'default', true);
         $session = e107::getSession();
         $session->set('HAuthError', true);
         $connected = false;
     }
     // no active session found
     if (!$connected) {
         return $this;
     }
     // query DB
     $sql = e107::getDb();
     $where = array();
     foreach ($connected as $providerId) {
         $adapter = Hybrid_Auth::getAdapter($providerId);
         if (!$adapter->getUserProfile()->identifier) {
             continue;
         }
         $id = $providerId . '_' . $adapter->getUserProfile()->identifier;
         $where[] = "user_xup='" . $sql->escape($id) . "'";
     }
     $where = implode(' OR ', $where);
     if ($sql->db_Select('user', 'user_id, user_password, user_xup', $where)) {
         $user = $sql->db_Fetch();
         e107::getUserSession()->makeUserCookie($user);
         $this->setSessionData();
     }
     return $this;
 }
开发者ID:JBeezygit,项目名称:e107,代码行数:40,代码来源:user_model.php

示例11: wsl_process_login

function wsl_process_login()
{
    if (!isset($_REQUEST['action']) || $_REQUEST['action'] != "wordpress_social_login") {
        return;
    }
    if (isset($_REQUEST['redirect_to']) && $_REQUEST['redirect_to'] != '') {
        $redirect_to = $_REQUEST['redirect_to'];
        // Redirect to https if user wants ssl
        if (isset($secure_cookie) && $secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
            $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
        }
        if (strpos($redirect_to, 'wp-admin')) {
            $redirect_to = get_option('wsl_settings_redirect_url');
        }
    }
    if (empty($redirect_to)) {
        $redirect_to = get_option('wsl_settings_redirect_url');
    }
    if (empty($redirect_to)) {
        $redirect_to = site_url();
    }
    try {
        // load hybridauth
        require_once dirname(__FILE__) . "/../hybridauth/Hybrid/Auth.php";
        // selected provider name
        $provider = @trim(strip_tags($_REQUEST["provider"]));
        // build required configuratoin for this provider
        if (!get_option('wsl_settings_' . $provider . '_enabled')) {
            throw new Exception('Unknown or disabled provider');
        }
        $config = array();
        $config["base_url"] = plugins_url() . '/' . basename(dirname(__FILE__)) . '/hybridauth/';
        $config["providers"] = array();
        $config["providers"][$provider] = array();
        $config["providers"][$provider]["enabled"] = true;
        // provider application id ?
        if (get_option('wsl_settings_' . $provider . '_app_id')) {
            $config["providers"][$provider]["keys"]["id"] = get_option('wsl_settings_' . $provider . '_app_id');
        }
        // provider application key ?
        if (get_option('wsl_settings_' . $provider . '_app_key')) {
            $config["providers"][$provider]["keys"]["key"] = get_option('wsl_settings_' . $provider . '_app_key');
        }
        // provider application secret ?
        if (get_option('wsl_settings_' . $provider . '_app_secret')) {
            $config["providers"][$provider]["keys"]["secret"] = get_option('wsl_settings_' . $provider . '_app_secret');
        }
        // create an instance for Hybridauth
        $hybridauth = new Hybrid_Auth($config);
        // try to authenticate the selected $provider
        if ($hybridauth->isConnectedWith($provider)) {
            $adapter = $hybridauth->getAdapter($provider);
            $hybridauth_user_profile = $adapter->getUserProfile();
        } else {
            throw new Exception('User not connected with ' . $provider . '!');
        }
        $user_email = $hybridauth_user_profile->email;
    } catch (Exception $e) {
        die("Unspecified error. #" . $e->getCode());
    }
    $user_id = null;
    // if the user email is verified, then try to map to legacy account if exist
    // > Currently only Facebook, Google, Yhaoo and Foursquare do provide the verified user email.
    if (!empty($hybridauth_user_profile->emailVerified)) {
        $user_id = (int) email_exists($hybridauth_user_profile->emailVerified);
    }
    // try to get user by meta if not
    if (!$user_id) {
        $user_id = (int) wsl_get_user_by_meta($provider, $hybridauth_user_profile->identifier);
    }
    // if user found
    if ($user_id) {
        $user_data = get_userdata($user_id);
        $user_login = $user_data->user_login;
    } else {
        // generate a valid user login
        $user_login = str_replace(' ', '_', strtolower($hybridauth_user_profile->displayName));
        if (!validate_username($user_login)) {
            $user_login = strtolower($provider) . "_user_" . md5($hybridauth_user_profile->identifier);
        }
        // user name should be unique
        if (username_exists($user_login)) {
            $i = 1;
            $user_login_tmp = $user_login;
            do {
                $user_login_tmp = $user_login . "_" . $i++;
            } while (username_exists($user_login_tmp));
            $user_login = $user_login_tmp;
        }
        // generate an email if none
        if (!isset($user_email) or !is_email($user_email)) {
            $user_email = strtolower($provider . "_user_" . $user_login) . "@example.com";
        }
        // email should be unique
        if (email_exists($user_email)) {
            do {
                $user_email = md5(uniqid(wp_rand(10000, 99000))) . "@example.com";
            } while (email_exists($user_email));
        }
        $userdata = array('user_login' => $user_login, 'user_email' => $user_email, 'first_name' => $hybridauth_user_profile->firstName, 'last_name' => $hybridauth_user_profile->lastName, 'user_nicename' => $hybridauth_user_profile->displayName, 'display_name' => $hybridauth_user_profile->displayName, 'user_url' => $hybridauth_user_profile->profileURL, 'description' => $hybridauth_user_profile->description, 'user_pass' => wp_generate_password());
//.........这里部分代码省略.........
开发者ID:niQo,项目名称:WordPress-Social-Login,代码行数:101,代码来源:plugin.auth.php

示例12: catch

    // well, basically your should not display this to the end user, just give him a hint and move on..
    $error .= "<br /><br /><b>Original error message:</b> " . $e->getMessage();
    $error .= "<hr /><pre>Trace:<br />" . $e->getTraceAsString() . "</pre>";
}
try {
    // create an instance for Hybridauth with the configuration file path as parameter
    $hybridauth = new Hybrid_Auth($config);
} catch (Exception $e) {
    showError($e);
}
// Trigger to logout one service or all at once
if (isset($_GET['logout'])) {
    if ($_GET['logout'] == "all") {
        $hybridauth->logoutAllProviders();
    } else {
        $adapter = $hybridauth->getAdapter($_GET['logout']);
        $adapter->logout();
    }
}
// if user select a provider to login with
// then inlcude hybridauth config and main class
// then try to authenticate te current user
// finally redirect him to his profile page
if (isset($_GET["provider"]) && $_GET["provider"]) {
    try {
        // set selected provider name
        $provider = @trim(strip_tags($_GET["provider"]));
        // try to authenticate the selected $provider
        $adapter = $hybridauth->authenticate($provider);
        // grab the user profile
        $user_data = $adapter->getUserProfile();
开发者ID:rootsdev,项目名称:hybridauth-genealogy,代码行数:31,代码来源:index.php

示例13: wsl_process_login_hybridauth_authenticate

function wsl_process_login_hybridauth_authenticate($provider, $redirect_to)
{
    try {
        # Hybrid_Auth already used?
        if (class_exists('Hybrid_Auth', false)) {
            return wsl_render_notices_pages(_wsl__("Error: Another plugin seems to be using HybridAuth Library and made WordPress Social Login unusable. We recommand to find this plugin and to kill it with fire!", 'wordpress-social-login'));
        }
        // load hybridauth
        require_once WORDPRESS_SOCIAL_LOGIN_ABS_PATH . "/hybridauth/Hybrid/Auth.php";
        // build required configuratoin for this provider
        if (!get_option('wsl_settings_' . $provider . '_enabled')) {
            throw new Exception('Unknown or disabled provider');
        }
        $config = array();
        $config["providers"] = array();
        $config["providers"][$provider] = array();
        $config["providers"][$provider]["enabled"] = true;
        // provider application id ?
        if (get_option('wsl_settings_' . $provider . '_app_id')) {
            $config["providers"][$provider]["keys"]["id"] = get_option('wsl_settings_' . $provider . '_app_id');
        }
        // provider application key ?
        if (get_option('wsl_settings_' . $provider . '_app_key')) {
            $config["providers"][$provider]["keys"]["key"] = get_option('wsl_settings_' . $provider . '_app_key');
        }
        // provider application secret ?
        if (get_option('wsl_settings_' . $provider . '_app_secret')) {
            $config["providers"][$provider]["keys"]["secret"] = get_option('wsl_settings_' . $provider . '_app_secret');
        }
        // create an instance for Hybridauth
        $hybridauth = new Hybrid_Auth($config);
        // try to authenticate the selected $provider
        if ($hybridauth->isConnectedWith($provider)) {
            $adapter = $hybridauth->getAdapter($provider);
            $hybridauth_user_profile = $adapter->getUserProfile();
            // check hybridauth user email
            $hybridauth_user_id = (int) wsl_get_user_by_meta($provider, $hybridauth_user_profile->identifier);
            $hybridauth_user_email = sanitize_email($hybridauth_user_profile->email);
            $hybridauth_user_login = sanitize_user($hybridauth_user_profile->displayName);
            $request_user_login = "";
            $request_user_email = "";
            # {{{ linking new accounts
            // Bouncer :: Accounts Linking is enabled
            if (get_option('wsl_settings_bouncer_linking_accounts_enabled') == 1) {
                // if user is linking account
                // . we DO import contacts
                // . we DO store the user profile
                //
                // . we DONT create another entry on user table
                // . we DONT create nor update his data on usermeata table
                if ($_REQUEST['action'] == "wordpress_social_link") {
                    global $current_user;
                    get_currentuserinfo();
                    $user_id = $current_user->ID;
                    return wsl_process_login_authenticate_wp_user_linked_account($user_id, $provider, $redirect_to, $adapter, $hybridauth_user_profile);
                }
                // check if connected user is linked account
                $linked_account = wsl_get_user_linked_account_by_provider_and_identifier($provider, $hybridauth_user_profile->identifier);
                // if linked account found, we connect the actual user
                if ($linked_account) {
                    if (count($linked_account) > 1) {
                        return wsl_render_notices_pages(_wsl__("This {$provider} is linked to many accounts!", 'wordpress-social-login'));
                    }
                    $user_id = $linked_account[0]->user_id;
                    if (!$user_id) {
                        return wsl_render_notices_pages(_wsl__("Something wrong!", 'wordpress-social-login'));
                    }
                    return wsl_process_login_authenticate_wp_user($user_id, $provider, $redirect_to, $adapter, $hybridauth_user_profile);
                }
            }
            # }}} linking new accounts
            # {{{ module Bouncer
            // Bouncer :: Filters by emails domains name
            if (get_option('wsl_settings_bouncer_new_users_restrict_domain_enabled') == 1) {
                if (empty($hybridauth_user_email)) {
                    return wsl_render_notices_pages(get_option('wsl_settings_bouncer_new_users_restrict_domain_text_bounce'));
                }
                $list = get_option('wsl_settings_bouncer_new_users_restrict_domain_list');
                $list = preg_split('/$\\R?^/m', $list);
                $current = strstr($hybridauth_user_email, '@');
                $shall_pass = false;
                foreach ($list as $item) {
                    if (trim(strtolower("@{$item}")) == strtolower($current)) {
                        $shall_pass = true;
                    }
                }
                if (!$shall_pass) {
                    return wsl_render_notices_pages(get_option('wsl_settings_bouncer_new_users_restrict_domain_text_bounce'));
                }
            }
            // Bouncer :: Filters by e-mails addresses
            if (get_option('wsl_settings_bouncer_new_users_restrict_email_enabled') == 1) {
                if (empty($hybridauth_user_email)) {
                    return wsl_render_notices_pages(get_option('wsl_settings_bouncer_new_users_restrict_email_text_bounce'));
                }
                $list = get_option('wsl_settings_bouncer_new_users_restrict_email_list');
                $list = preg_split('/$\\R?^/m', $list);
                $shall_pass = false;
                foreach ($list as $item) {
                    if (trim(strtolower($item)) == strtolower($hybridauth_user_email)) {
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:wsl.authentication.php

示例14: array

 function do_logout()
 {
     // after login come back to the same page
     $loginCallback = qa_path('', array(), qa_opt('site_url'));
     require_once "Hybrid/Auth.php";
     // prepare the configuration of HybridAuth
     $config = $this->getConfig($loginCallback);
     try {
         // try to logout
         $hybridauth = new Hybrid_Auth($config);
         if ($hybridauth->isConnectedWith($this->provider)) {
             $adapter = $hybridauth->getAdapter($this->provider);
             $adapter->logout();
         }
     } catch (Exception $e) {
         // not really interested in the error message - for now
         // however, in case we have errors 6 or 7, then we have to call logout to clean everything up
         if ($e->getCode() == 6 || $e->getCode() == 7) {
             $adapter->logout();
         }
     }
 }
开发者ID:microbye,项目名称:q2a-open-login,代码行数:22,代码来源:qa-open-login.php

示例15: SocialAuth_WP_contacts

function SocialAuth_WP_contacts()
{
    ini_set("display_errors", 0);
    $noContactMsg = "Either you do not have any contact(s) or your login provider is not supporting this feature at the moment.";
    echo '<div class="wrap">';
    echo '<div class="icon32 icon32-posts-post" id="icon-edit"><br></div>';
    echo "<h2>My Contacts</h2> <br/>";
    // load hybridauth
    require_once dirname(__FILE__) . "/hybridauth/Hybrid/Auth.php";
    // load wp-load.php
    $wp_load = dirname(dirname(dirname(dirname(__FILE__)))) . '/wp-load.php';
    require_once $wp_load;
    include_once 'common.php';
    $user_id = get_current_user_id();
    $provider = null;
    if ($user_id != 0) {
        $provider = get_user_meta($user_id, 'ha_login_provider', true);
    }
    // selected provider name
    if ($provider == null) {
        echo $noContactMsg;
        return;
    }
    //global $HA_PROVIDER_CONFIG;
    $SocialAuth_WP_providers = get_option('SocialAuth_WP_providers');
    if (is_array($SocialAuth_WP_providers) && count($SocialAuth_WP_providers)) {
        $config = array();
        if (isset($SocialAuth_WP_providers[$provider])) {
            $config["base_url"] = plugin_dir_url(__FILE__) . 'hybridauth/';
            $config["providers"] = array();
            //this si same as orig config, no need to amke config again
            $config["providers"][$provider] = $SocialAuth_WP_providers[$provider];
        } else {
            echo "Current Provider is unknowun to system.";
            return;
        }
    } else {
        echo "It seems SocialAuth-WP plugin is not configured properly. Please contact site administrator.";
        return;
    }
    // create an instance for Hybridauth
    $hybridauth = new Hybrid_Auth($config);
    $adapter = null;
    // try to check is provider still authenticated
    if ($hybridauth->isConnectedWith($provider)) {
        $adapter = $hybridauth->getAdapter($provider);
    } else {
        echo "It seems your session with Login provider has expired. Please logout and login again to system to continue.";
        return;
    }
    $contacts = array();
    try {
        $contacts = $adapter->getUserContacts();
    } catch (exception $e) {
        echo $noContactMsg;
        return;
    }
    if (count($contacts)) {
        require SOCIALAUTH_WP_PLUGIN_PATH . '/pagination.class.php';
        $pagination = new pagination($contacts, isset($_GET['pageNum']) ? $_GET['pageNum'] : 1, 15);
        $ContactPages = $pagination->getResults();
        $tbHeaders = array('Name', 'Profile URL', 'Email');
        ?>
        <?php 
        if (count($ContactPages) != 0) {
            echo $pageNumbers = '<div class="numbers" style="text-align:right;" >' . $pagination->getLinks(array('page' => 'SocialAuth-WP-contacts')) . '</div>';
            ?>
    
    <table class="wp-list-table widefat fixed users">
    <thead>
    <tr>
        <?php 
            foreach ($tbHeaders as $header) {
                echo '<th style="" class="manage-column column-username" id="" scope="col">' . $header . '</th>';
            }
            ?>
        
        </tr>
    </thead>
    
    <tfoot>
    <tr>
        <?php 
            foreach ($tbHeaders as $header) {
                echo '<th style="" class="manage-column column-username" id="" scope="col">' . $header . '</th>';
            }
            ?>
        
        </tr>
    </tfoot>
    
    <tbody class="list:user" id="the-list">
    <?php 
            foreach ($ContactPages as $index => $contact) {
                $alternate = $index % 2 == 0 ? "alternate" : "";
                ?>
    
    <tr class="<?php 
                echo $alternate;
                ?>
//.........这里部分代码省略.........
开发者ID:3pillarlabs,项目名称:socialauth-wp,代码行数:101,代码来源:feature-friends.php


注:本文中的Hybrid_Auth::getAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。