本文整理汇总了PHP中Hybrid_Auth::getProviders方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Auth::getProviders方法的具体用法?PHP Hybrid_Auth::getProviders怎么用?PHP Hybrid_Auth::getProviders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hybrid_Auth
的用法示例。
在下文中一共展示了Hybrid_Auth::getProviders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
unset($cpf_check[0]);
foreach ($cpf_check as $cpf_error) {
$registration_errors[] = $cpf_error;
}
}
// validate HybridAuth provider and user id and check if it's already in the db (shouldn't be
// because the user would be logged in the system rather than redirected here)
// check if there are any available alternative providers for authentication
if (!empty($_POST['provider_id'])) {
require_once 'modules/auth/methods/hybridauth/config.php';
require_once 'modules/auth/methods/hybridauth/Hybrid/Auth.php';
$config = get_hybridauth_config();
$hybridauth = new Hybrid_Auth( $config );
$allProviders = $hybridauth->getProviders();
$provider = '';
$warning = '';
// check if $_POST['provider'] is valid and enabled
if (count($allProviders) && array_key_exists(ucfirst($_POST['provider']), $allProviders)) {
$provider = strtolower($_POST['provider']);
}
if (!empty($_POST['provider_id']) && !empty($provider)) {
// if !empty($provider), it means the provider is existent and valid - it's checked above
try {
// create an instance for Hybridauth with the configuration file path as parameter
$hybridauth = new Hybrid_Auth($config);
// try to authenticate the selected $provider
$adapter = $hybridauth->authenticate($provider);