$authbyname = array();
foreach ($auths as $auth) {
- $strauthname = get_string("auth_{$auth}title", "auth");
- if ($strauthname == "[[auth_{$auth}title]]") {
- $strauthname = get_string("auth_{$auth}title", "auth_{$auth}");
- }
+ $strauthname = auth_get_plugin_title($auth);
$authbyname[$strauthname] = $auth;
}
ksort($authbyname);
$plugins = get_enabled_auth_plugins();
$choices = array();
foreach ($plugins as $plugin) {
- $choices[$plugin] = get_string('auth_'.$plugin.'title', 'auth');
+ $choices[$plugin] = auth_get_plugin_title ($plugin);
}
return $choices;
* Return the properly translated human-friendly title of this auth plugin
*/
function get_title() {
- $authtitle = get_string("auth_{$this->authtype}title", "auth");
- if ($authtitle == "[[auth_{$this->authtype}title]]") {
- $authtitle = get_string("auth_{$this->authtype}title", "auth_{$this->authtype}");
- }
- return $authtitle;
+ return auth_get_plugin_title($this->authtype);
}
/**
}
}
+/**
+ * Return the authentication plugin title
+ * @param string $authtype plugin type
+ * @return string
+ */
+function auth_get_plugin_title ($authtype) {
+ $authtitle = get_string("auth_{$authtype}title", "auth");
+ if ($authtitle == "[[auth_{$authtype}title]]") {
+ $authtitle = get_string("auth_{$authtype}title", "auth_{$authtype}");
+ }
+ return $authtitle;
+}
+
// vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
?>
$modules = get_list_of_plugins('auth');
$auth_options = array();
foreach ($modules as $module) {
- $auth_options[$module] = get_string("auth_$module"."title", "auth");
+ $auth_options[$module] = auth_get_plugin_title ($module);
}
$mform->addElement('select', 'auth', get_string('chooseauthmethod','auth'), $auth_options);
$mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod','auth')));
$plugins = get_list_of_plugins('auth');
$choices = array();
foreach ($plugins as $auth) {
- $choices[$auth] = get_string("auth_{$auth}title", 'auth');
+ $choices[$auth] = auth_get_plugin_title ($auth);
}
return new user_filter_simpleselect('auth', get_string('authentication'), $advanced, 'auth', $choices);