本文整理汇总了PHP中AuthLdap::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthLdap::getLink方法的具体用法?PHP AuthLdap::getLink怎么用?PHP AuthLdap::getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthLdap
的用法示例。
在下文中一共展示了AuthLdap::getLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMethodName
/**
* Get name of an authentication method
*
* @param $authtype Authentication method
* @param $auths_id Authentication method ID
* @param $link show links to config page ? (default 0)
* @param $name override the name if not empty (default '')
*
* @return string
*/
static function getMethodName($authtype, $auths_id, $link = 0, $name = '')
{
switch ($authtype) {
case self::LDAP:
$auth = new AuthLdap();
if ($auth->getFromDB($auths_id)) {
//TRANS: %1$s is the auth method type, %2$s the auth method name or link
return sprintf(__('%1$s: %2$s'), AuthLdap::getTypeName(1), $auth->getLink());
}
return sprintf(__('%1$s: %2$s'), __('LDAP directory'), $name);
case self::MAIL:
$auth = new AuthMail();
if ($auth->getFromDB($auths_id)) {
//TRANS: %1$s is the auth method type, %2$s the auth method name or link
return sprintf(__('%1$s: %2$s'), AuthLdap::getTypeName(1), $auth->getLink());
}
return sprintf(__('%1$s: %2$s'), __('Email server'), $name);
case self::CAS:
if ($auths_id > 0) {
$auth = new AuthLdap();
if ($auth->getFromDB($auths_id)) {
return sprintf(__('%1$s: %2$s'), sprintf(__('%1$s + %2$s'), __('CAS'), AuthLdap::getTypeName(1)), $auth->getLink());
}
}
return __('CAS');
case self::X509:
if ($auths_id > 0) {
$auth = new AuthLdap();
if ($auth->getFromDB($auths_id)) {
return sprintf(__('%1$s: %2$s'), sprintf(__('%1$s + %2$s'), __('x509 certificate authentication'), AuthLdap::getTypeName(1)), $auth->getLink());
}
}
return __('x509 certificate authentication');
case self::EXTERNAL:
if ($auths_id > 0) {
$auth = new AuthLdap();
if ($auth->getFromDB($auths_id)) {
return sprintf(__('%1$s: %2$s'), sprintf(__('%1$s + %2$s'), __('Other'), AuthLdap::getTypeName(1)), $auth->getLink());
}
}
return __('Other');
case self::DB_GLPI:
return __('GLPI internal database');
case self::NOT_YET_AUTHENTIFIED:
return __('Not yet authenticated');
}
return '';
}
示例2: getMethodName
/**
* Get name of an authentication method
*
* @param $authtype Authentication method
* @param $auths_id Authentication method ID
* @param $link show links to config page ?
* @param $name override the name if not empty
*
* @return string
*/
static function getMethodName($authtype, $auths_id, $link = 0, $name = '')
{
global $LANG;
switch ($authtype) {
case self::LDAP:
$auth = new AuthLdap();
if ($auth->getFromDB($auths_id)) {
return $auth->getTypeName() . " " . $auth->getLink();
}
return $LANG['login'][2] . " {$name}";
case self::MAIL:
$auth = new AuthMail();
if ($auth->getFromDB($auths_id)) {
return $auth->getTypeName() . " " . $auth->getLink();
}
return $LANG['login'][3] . " {$name}";
case self::CAS:
$out = $LANG['login'][4];
if ($auths_id > 0) {
$auth = new AuthLdap();
if ($auth->getFromDB($auths_id)) {
$out .= " + " . $auth->getTypeName() . " " . $auth->getLink();
}
}
return $out;
case self::X509:
$out = $LANG['setup'][190];
if ($auths_id > 0) {
$auth = new AuthLdap();
if ($auth->getFromDB($auths_id)) {
$out .= " + " . $auth->getTypeName() . " " . $auth->getLink();
}
}
return $out;
case self::EXTERNAL:
$out = $LANG['common'][62];
if ($auths_id > 0) {
$auth = new AuthLdap();
if ($auth->getFromDB($auths_id)) {
$out .= " + " . $auth->getTypeName() . " " . $auth->getLink();
}
}
return $out;
case self::DB_GLPI:
return $LANG['login'][18];
case self::NOT_YET_AUTHENTIFIED:
return $LANG['login'][9];
}
return '';
}