本文整理汇总了PHP中Gdn_AuthenticationProviderModel::getProviders方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_AuthenticationProviderModel::getProviders方法的具体用法?PHP Gdn_AuthenticationProviderModel::getProviders怎么用?PHP Gdn_AuthenticationProviderModel::getProviders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_AuthenticationProviderModel
的用法示例。
在下文中一共展示了Gdn_AuthenticationProviderModel::getProviders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: disconnect
/**
*
*
* @param string $UserReference
* @param string $Username
* @param $Provider
* @throws Exception
*/
public function disconnect($UserReference = '', $Username = '', $Provider)
{
if (!Gdn::request()->isAuthenticatedPostBack(true)) {
throw new Exception('Requires POST', 405);
}
$this->permission('Garden.SignIn.Allow');
$this->getUserInfo($UserReference, $Username, '', true);
// First try and delete the authentication the fast way.
Gdn::sql()->delete('UserAuthentication', array('UserID' => $this->User->UserID, 'ProviderKey' => $Provider));
// Delete the profile information.
Gdn::userModel()->saveAttribute($this->User->UserID, $Provider, null);
if ($this->deliveryType() == DELIVERY_TYPE_ALL) {
redirect(userUrl($this->User), '', 'connections');
} else {
// Grab all of the providers again.
$PModel = new Gdn_AuthenticationProviderModel();
$Providers = $PModel->getProviders();
$this->setData('_Providers', $Providers);
$this->setData('Connections', array());
$this->fireEvent('GetConnections');
// Send back the connection button.
$Connection = $this->data("Connections.{$Provider}");
require_once $this->fetchViewLocation('connection_functions');
$this->jsonTarget("#Provider_{$Provider} .ActivateSlider", connectButton($Connection), 'ReplaceWith');
$this->render('Blank', 'Utility', 'Dashboard');
}
}
示例2: trustedDomains
/**
* Get an array of all of the trusted domains in the application.
*
* @return array
*/
function trustedDomains()
{
// This domain is safe.
$trustedDomains = [Gdn::request()->host()];
$configuredDomains = c('Garden.TrustedDomains', []);
if (!is_array($configuredDomains)) {
$configuredDomains = is_string($configuredDomains) ? explode("\n", $configuredDomains) : [];
}
$configuredDomains = array_filter($configuredDomains);
$trustedDomains = array_merge($trustedDomains, $configuredDomains);
// Build a collection of authentication provider URLs.
$authProviderModel = new Gdn_AuthenticationProviderModel();
$providers = $authProviderModel->getProviders();
$providerUrls = ['PasswordUrl', 'ProfileUrl', 'RegisterUrl', 'SignInUrl', 'SignOutUrl', 'URL'];
// Iterate through the providers, only grabbing URLs if they're not empty and not already present.
if (is_array($providers) && count($providers) > 0) {
foreach ($providers as $key => $record) {
foreach ($providerUrls as $urlKey) {
$providerUrl = $record[$urlKey];
if ($providerUrl && ($providerDomain = parse_url($providerUrl, PHP_URL_HOST))) {
if (!in_array($providerDomain, $trustedDomains)) {
$trustedDomains[] = $providerDomain;
}
}
}
}
}
Gdn::pluginManager()->EventArguments['TrustedDomains'] =& $trustedDomains;
Gdn::pluginManager()->fireAs('EntryController')->fireEvent('BeforeTargetReturn');
return array_unique($trustedDomains);
}