function translateSpaceName($space_name) { global $charset; $_this =& L10n::getInstance(); if (preg_match('/[\\x80-\\xff]./', $space_name)) { //Convert To Kanji Pinyin. $space_name = preg_replace('/\\s(?=\\s)/', '', $space_name); $space_name = iconv($charset, "gb2312", $space_name); require LOCALE_PATH . "topinyin.class.php"; $cn = new ChineseSpell(); return str_replace(" ", "", $_this->normalize($cn->getFullSpell($space_name))); } else { return $_this->normalize($space_name); } }
function translateSpaceName($space_name) { global $charset, $app_lang; switch ($app_lang) { case "zh-cn": $space_name = preg_replace('/\\s(?=\\s)/', '', $space_name); $space_name = iconv($charset, "gb2312", $space_name); require LOCALE_PATH . "topinyin.class.php"; $cn = new ChineseSpell(); $return = str_replace(" ", "", $this->normalize($cn->getFullSpell($space_name))); break; default: $return = $this->normalize($space_name); break; } return $return; }
/** Function to save the user information into the database * @param $module -- module name:: Type varchar * */ function save($module_name) { global $log; $log->debug("module name is " . $module_name); //GS Save entity being called with the modulename as parameter $this->saveentity($module_name); if ($this->column_fields['user_name'] != "") { require_once "include/utils/ChineseSpellUtils.php"; $spell = new ChineseSpell(); $chineseStr = $this->column_fields['user_name']; $chineseStr = iconv_ec("UTF-8", "GBK", $chineseStr); $prefixa = $spell->getFullSpell($chineseStr, ''); $prefixa = strtoupper($prefixa); $query = "update ec_users set prefix='" . $prefixa . "' where id='" . $this->id . "'"; $this->db->query($query); } }
function get_userfolder($userid) { $key = "get_userfolder_" . $userid; $userfolder = getSqlCacheData($key); if (!$userfolder) { global $adb, $mailstore_directory; //global $log; $userfolder = ""; $current_username = getUserName($userid); if ($current_username == "") { return $mailstore_directory; } require_once "include/utils/ChineseSpellUtils.php"; $spell = new ChineseSpell(); $length = str_len($current_username); $current_username = iconv_ec("UTF-8", "GBK", $current_username); $current_username = $spell->getFullSpell($current_username, ""); $current_username = strtolower($current_username); $userfolder = $mailstore_directory . $current_username . "/"; setSqlCacheData($key, $userfolder); } return $userfolder; }