From: jerome Date: Thu, 14 May 2009 07:03:27 +0000 (+0000) Subject: authentication MDL-18273 Custom Authentication Plugin title can be retrieved from... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2a274f2a93c039e32eb92b2a94cea63554ece28c;p=moodle.git authentication MDL-18273 Custom Authentication Plugin title can be retrieved from specific language file, merged from 19 --- diff --git a/admin/settings/users.php b/admin/settings/users.php index 01b141cd64..c725cf4e1c 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -41,10 +41,7 @@ if ($hassiteconfig $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); diff --git a/admin/uploaduser.php b/admin/uploaduser.php index 67516cc8a7..9b55b3c484 100755 --- a/admin/uploaduser.php +++ b/admin/uploaduser.php @@ -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; diff --git a/lib/authlib.php b/lib/authlib.php index 1e143884d9..2a35e462de 100644 --- a/lib/authlib.php +++ b/lib/authlib.php @@ -360,11 +360,7 @@ class auth_plugin_base { * 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); } /** diff --git a/lib/weblib.php b/lib/weblib.php index 2c67564d7f..a547edcaf9 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -7324,5 +7324,18 @@ class html_list_progress_trace extends moodle_progress_trace { } } +/** + * 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: ?> diff --git a/user/editadvanced_form.php b/user/editadvanced_form.php index 0824340df7..e498ed0244 100644 --- a/user/editadvanced_form.php +++ b/user/editadvanced_form.php @@ -27,7 +27,7 @@ class user_editadvanced_form extends moodleform { $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'))); diff --git a/user/filters/lib.php b/user/filters/lib.php index 7adb207f7c..a71db1583f 100644 --- a/user/filters/lib.php +++ b/user/filters/lib.php @@ -118,7 +118,7 @@ class user_filtering { $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);