Skip to content

Commit

Permalink
authentication MDL-18273 Custom Authentication Plugin title can be re…
Browse files Browse the repository at this point in the history
…trieved from specific language file, merged from 19
  • Loading branch information
jerome committed May 14, 2009
1 parent dc247e5 commit 2a274f2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
5 changes: 1 addition & 4 deletions admin/settings/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
$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);
Expand Down
2 changes: 1 addition & 1 deletion admin/uploaduser.php
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ function uu_allowed_auths() {
$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;
Expand Down
6 changes: 1 addition & 5 deletions lib/authlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,7 @@ function ignore_timeout_hook($user, $sid, $timecreated, $timemodified) {
* 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);
}

/**
Expand Down
13 changes: 13 additions & 0 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -7324,5 +7324,18 @@ public function finished() {
}
}

/**
* 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:
?>
2 changes: 1 addition & 1 deletion user/editadvanced_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function definition() {
$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')));
Expand Down
2 changes: 1 addition & 1 deletion user/filters/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function get_field($fieldname, $advanced) {
$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);

Expand Down

0 comments on commit 2a274f2

Please sign in to comment.