Code

Updated smarty to 1.0.9
[gosa.git] / gosa-core / include / smarty / plugins / modifiercompiler.upper.php
index 739057ce9e9cb595b3ddf25b72ccb3b01d71ab4e..2869b879fb08c735fc80657fefc510a0b0d91f30 100644 (file)
  */\r
 function smarty_modifiercompiler_upper($params, $compiler)\r
 {\r
-    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\r
-        return 'mb_strtoupper(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET)' ;\r
-    }\r
-    // no MBString fallback\r
-    return 'strtoupper(' . $params[0] . ')';\r
+    if (function_exists('mb_strtoupper')) {\r
+        return '((mb_detect_encoding(' . $params[0] . ', \'UTF-8, ISO-8859-1\') === \'UTF-8\') ? mb_strtoupper(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET) : strtoupper(' . $params[0] . '))' ;\r
+    } else {\r
+        return 'strtoupper(' . $params[0] . ')';\r
+    } \r
 } \r
 \r
 ?>
\ No newline at end of file