]> git.mjollnir.org Git - moodle.git/commitdiff
Reverted latest changes. We are going to continue faithful to
authorstronk7 <stronk7>
Thu, 9 Mar 2006 17:18:15 +0000 (17:18 +0000)
committerstronk7 <stronk7>
Thu, 9 Mar 2006 17:18:15 +0000 (17:18 +0000)
Typo3 versions. We can solve this ourselves in textlib.php

lib/typo3/class.t3lib_cs.php

index 4f28cb35ea0a1134e6fa45e7221af2dd75d171d5..ee34b89de63f890c05ee7a076805d72a5ebc2bd5 100644 (file)
@@ -24,7 +24,8 @@
 /**
  * Class for conversion between charsets.
  *
- * $Id$
+ *    Typo Id: class.t3lib_cs.php,v 1.54.2.2 2006/02/22 00:44:07 typo3 Exp $
+ * Moodle $Id$
  *
  * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @author     Martin Kutschker <martin.t.kutschker@blackbox.net>
@@ -449,6 +450,9 @@ class t3lib_cs {
                'eo' => 'utf-8',
                'my' => '',
                'hi' => 'utf-8',
+               'fo' => 'utf-8',
+               'fa' => 'utf-8',
+               'sr' => 'utf-8'
        );
 
                // TYPO3 specific: Array with the iso names used for each system language in TYPO3:
@@ -995,7 +999,8 @@ class t3lib_cs {
                        // Only process if the tables are not yet loaded
                switch($mode)   {
                        case 'case':
-                               if (!empty($this->caseFolding['utf-8']) && is_array($this->caseFolding['utf-8']))       return 1; //dirty skodak's hack to get rid of the warning
+                               if (is_array($this->caseFolding['utf-8']))      return 1;
+
                                        // Use cached version if possible
                                if ($cacheFileCase && @is_file($cacheFileCase)) {
                                        $this->caseFolding['utf-8'] = unserialize(t3lib_div::getUrl($cacheFileCase));
@@ -1004,7 +1009,7 @@ class t3lib_cs {
                                break;
 
                        case 'ascii':
-                               if (!empty($this->toASCII['utf-8']) && is_array($this->toASCII['utf-8']))       return 1; //dirty skodak's hack to get rid of the warning
+                               if (is_array($this->toASCII['utf-8']))  return 1;
 
                                        // Use cached version if possible
                                if ($cacheFileASCII && @is_file($cacheFileASCII))       {
@@ -1517,17 +1522,17 @@ class t3lib_cs {
        function conv_case($charset,$string,$case)      {
                if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_utils'] == 'mbstring' && (float)phpversion() >= 4.3)   {
                        if ($case == 'toLower') {
-                               return mb_strtolower($string,$charset);
+                               $string = mb_strtolower($string,$charset);
                        } else {
-                               return mb_strtoupper($string,$charset);
+                               $string = mb_strtoupper($string,$charset);
                        }
                } elseif ($charset == 'utf-8')  {
-                       return $this->utf8_char_mapping($string,'case',$case);
+                       $string = $this->utf8_char_mapping($string,'case',$case);
                } elseif (isset($this->eucBasedSets[$charset])) {
-                       return $this->euc_char_mapping($string,$charset,'case',$case);
+                       $string = $this->euc_char_mapping($string,$charset,'case',$case);
                } else {
                                // treat everything else as single-byte encoding
-                       return $this->sb_char_mapping($string,$charset,'case',$case);
+                       $string = $this->sb_char_mapping($string,$charset,'case',$case);
                }
 
                return $string;
@@ -1542,12 +1547,12 @@ class t3lib_cs {
         */
        function specCharsToASCII($charset,$string)     {
                if ($charset == 'utf-8')        {
-                       return $this->utf8_char_mapping($string,'ascii');
+                       $string = $this->utf8_char_mapping($string,'ascii');
                } elseif (isset($this->eucBasedSets[$charset])) {
-                       return $this->euc_char_mapping($string,$charset,'ascii');
+                       $string = $this->euc_char_mapping($string,$charset,'ascii');
                } else {
                                // treat everything else as single-byte encoding
-                       return $this->sb_char_mapping($string,$charset,'ascii');
+                       $string = $this->sb_char_mapping($string,$charset,'ascii');
                }
 
                return $string;
@@ -1740,7 +1745,7 @@ class t3lib_cs {
                if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_utils'] == 'mbstring') {
                        return mb_strrpos($haystack,$needle,'utf-8');
                } elseif ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_utils'] == 'iconv')      {
-                       return iconv_strrpos($haystack,$needle,$offset,'utf-8');
+                       return iconv_strrpos($haystack,$needle,'utf-8');
                }
 
                $byte_pos = strrpos($haystack,$needle);
@@ -1839,8 +1844,7 @@ class t3lib_cs {
                                return $str;
                }
 
-        $length = strlen($str); //dirty skodak's hack to get rid of the warning
-               for($i=0; $i<$length && strlen($str{$i}); $i++) {
+               for($i=0; strlen($str{$i}); $i++)       {
                        $c = ord($str{$i});
                        if (!($c & 0x80))       // single-byte (0xxxxxx)
                                $mbc = $str{$i};