/** 修改组 **/ public function ajaxUpdateGroupPost($request, $response) { /*{{{*/ header('Content-Type: text/html; charset=GBK'); $categoryName = mb_convert_encoding($request->category_name, 'gbk', 'auto'); if (8 < mb_strlen($categoryName, 'gbk')) { echo json_encode(array('status' => '1', 'content' => XString::convertToUnicode("分组名称不能超过8个字符"))); return parent::DIRECT_OUTPUT; } ForumClient::getInstance()->modifyGroupName($request->category_id, $categoryName); echo json_encode(array('status' => '0', 'content' => XString::convertToUnicode(Multibytes::chn_truncate($categoryName, 13)))); return parent::DIRECT_OUTPUT; }
public static function trans($txt, $gifpath = "http://www.haodf.com") { self::init(); foreach (self::$charset as $k => $v) { //注意, 前缀, 后缀一定不能包含要被替代的字符, 切记!!!! //$k 强行转成string的原因是 数组里键'9'在foreach过程中被转换成(int)9,导致strpos函数不查找'9', 而查找chr(9)/\t, 而出错 09.06.24 $txt = Multibytes::chn_str_replace((string) $k, '[~' . $k . '@]', $txt); // $txt = str_replace($k, '[~'.$k.'@]', $txt); } foreach (self::$charset as $k => $v) { //$txt = str_replace('[~'.$k.'@]', '<img src="'.$gifpath.'/g'.self::$charmap[$v].'.gif" border="0"/>', $txt); $txt = str_replace('[~' . $k . '@]', '<img src="' . self::genImgUrl(self::$charmap[$v] . '.gif') . '" border="0"/>', $txt); } return $txt; }
function substr($string, $start = 0, $length = 2147483647) { if ($start === 0 && $length === null) { return $string; } $string = Multibytes::utf8($string); $stringCount = count($string); for ($i = 1; $i <= $start; $i++) { unset($string[$i - 1]); } if ($length === null || count($string) < $length) { return Multibytes::ascii($string); } $string = array_values($string); $value = array(); for ($i = 0; $i < $length; $i++) { $value[] = $string[$i]; } return Multibytes::ascii($value); }
echo $articleInfo->id; ?> " value="<?php echo $articleInfo->id; ?> " /> <a href="javascript:;" class="span_btn" style="display:block" onclick="shareArticle('<?php echo $articleInfo->id; ?> ')">分享此文章</a> <span class="mr5">[<?php echo $articleInfo->articleCategory->name; ?> ]</span> <a href="javascript:;"><?php echo Multibytes::chn_truncate(htmlspecialchars($articleInfo->title, ENT_COMPAT, 'ISO-8859-1'), 40); ?> </a> </li> <?php } ?> </ul> <?php if ($pagelink) { ?> <div id="fenye" class="pt20 pl20 page_ajaxarticle"><?php echo $pagelink; ?> </div> <?php
} ?> " title="<?php echo $group->name . ':' . $groupCnt . '人' . $group->reTopicCount . '话题'; ?> "> <p class="group_name" hiddenvalue="<?php echo $group->name; ?> " > <a class="432" href="<?php echo $router->urlfor('adminpatient/index', array('p_type' => $group->id)); ?> "> <?php echo Multibytes::chn_truncate($group->name, 13); ?> </a> <span class="gray2 f12">(<?php echo $groupCnt . '人,' . $group->reTopicCount; ?> )</span> </p> <p class="group_input dn pl5"><input type="" id="<?php echo $group->id; ?> " value="<?php echo $group->name; ?> " class="input_group update_group" /></p> <p class="group_op pr">