]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from MOODLE_19_STABLE: MDL-12440: take out auth title and description into...
authormjollnir_ <mjollnir_>
Thu, 31 Jan 2008 22:02:44 +0000 (22:02 +0000)
committermjollnir_ <mjollnir_>
Thu, 31 Jan 2008 22:02:44 +0000 (22:02 +0000)
admin/auth_config.php
lib/adminlib.php
lib/authlib.php

index 6848e7c551cacbed2f14a22676cb0125b4e8c5dc..f7f7193ab3b8623ebf031ca97a2a644b1c817bf4 100644 (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();
index bc4332f3c9f8c8e4efd1dcad45c5cd1a21ea1acb..0f0763248aae51d1f074b780c11dd8023ac7e435 100644 (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()) {
index ca942381e04c9ea3b3bf3700dadf84b999ab1f8e..242d2cd3a4fb5f9b97c284201128ade48d34de1f 100644 (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;
+    }
 }
 
 ?>