]> git.mjollnir.org Git - moodle.git/commitdiff
Change the moodle_strtolower() function to use textlib services.
authorstronk7 <stronk7>
Sat, 10 Jun 2006 10:40:16 +0000 (10:40 +0000)
committerstronk7 <stronk7>
Sat, 10 Jun 2006 10:40:16 +0000 (10:40 +0000)
Also, mark it as deprecated, code should use text services directly.
Partially, bug 5777. It continues under investigation.
(http://moodle.org/bugs/bug.php?op=show&bugid=5777)

Merged from MOODLE_16_STABLE

lib/moodlelib.php

index 69a5e0b26434072a40d40189af606037a7c194cf..46e74f2a9179d2ce429bf590c31204228e5c19c2 100644 (file)
@@ -5975,17 +5975,18 @@ function moodle_setlocale($locale='') {
  * @param string $encoding The encoding on the string.
  * @return string
  * @todo Add examples of calling this function with/without encoding types
+ * @deprecated Use textlib->strtolower($text, current_charset()) instead.
  */
 function moodle_strtolower ($string, $encoding='') {
-    if (function_exists('mb_strtolower')) {
-        if($encoding===''){
-           return mb_strtolower($string);          //use multibyte support with default encoding
-        } else {
-           return mb_strtolower($string, $encoding); //use given encoding
-        }
-    } else {
-        return strtolower($string);                // use common function what rely on current locale setting
+    
+    //If not specified, get the current encoding
+    if (empty($encoding)) {
+        $encoding = current_charset();
     }
+    //Use text services
+    $textlib = textlib_get_instance();
+
+    return $textlib->strtolower($string, $encoding);
 }
 
 /**