Merged from MOODLE_19_STABLE: MDL-12440: take out auth title and description into base class, plugins can override. updated places that use get_string to call these methods. Credit: Luke Hudson <[email protected]>

This commit is contained in:
mjollnir_
2008-01-31 22:02:44 +00:00
parent 9d042298ff
commit 2a5f4a885b
3 changed files with 29 additions and 24 deletions
+2 -8
View File
@@ -51,15 +51,9 @@ if ($frm = data_submitted() and confirm_sesskey()) {
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
/// Get the auth title (from core or own auth lang files)
$authtitle = get_string("auth_{$auth}title", "auth");
if ($authtitle == "[[auth_{$auth}title]]") {
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
}
$authtitle = $authplugin->get_title();
/// Get the auth descriptions (from core or own auth lang files)
$authdescription = get_string("auth_{$auth}description", "auth");
if ($authdescription == "[[auth_{$auth}description]]") {
$authdescription = get_string("auth_{$auth}description", "auth_{$auth}");
}
$authdescription = $authplugin->get_description();
// output configuration form
admin_externalpage_print_header();
+5 -16
View File
@@ -3480,10 +3480,7 @@ class admin_setting_special_registerauth extends admin_setting_configselect {
continue;
}
// Get the auth title (from core or own auth lang files)
$authtitle = get_string("auth_{$auth}title", "auth");
if ($authtitle == "[[auth_{$auth}title]]") {
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
}
$authtitle = $authplugin->get_title();
$this->choices[$auth] = $authtitle;
}
return true;
@@ -3603,10 +3600,8 @@ class admin_setting_manageauths extends admin_setting {
if (strpos($auth, $query) !== false) {
return true;
}
$authtitle = get_string("auth_{$auth}title", "auth");
if ($authtitle == "[[auth_{$auth}title]]") {
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
}
$authplugin = get_auth_plugin($auth);
$authtitle = $authplugin->get_title();
if (strpos($textlib->strtolower($authtitle), $query) !== false) {
return true;
}
@@ -3639,10 +3634,7 @@ class admin_setting_manageauths extends admin_setting {
foreach ($authsenabled as $auth) {
$authplugin = get_auth_plugin($auth);
/// Get the auth title (from core or own auth lang files)
$authtitle = get_string("auth_{$auth}title", "auth");
if ($authtitle == "[[auth_{$auth}title]]") {
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
}
$authtitle = $authplugin->get_title();
/// Apply titles
$displayauths[$auth] = $authtitle;
if ($authplugin->can_signup()) {
@@ -3656,10 +3648,7 @@ class admin_setting_manageauths extends admin_setting {
}
$authplugin = get_auth_plugin($auth);
/// Get the auth title (from core or own auth lang files)
$authtitle = get_string("auth_{$auth}title", "auth");
if ($authtitle == "[[auth_{$auth}title]]") {
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
}
$authtitle = $authplugin->get_title();
/// Apply titles
$displayauths[$auth] = $authtitle;
if ($authplugin->can_signup()) {
+22
View File
@@ -320,6 +320,28 @@ class auth_plugin_base {
//override if needed
}
/**
* 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;
}
/**
* Get the auth description (from core or own auth lang files)
*/
function get_description() {
$authdescription = get_string("auth_{$this->authtype}description", "auth");
if ($authdescription == "[[auth_{$this->authtype}description]]") {
$authdescription = get_string("auth_{$this->authtype}description", "auth_{$this->authtype}");
}
return $authdescription;
}
}
?>