本文整理汇总了PHP中Chinese::convert方法的典型用法代码示例。如果您正苦于以下问题:PHP Chinese::convert方法的具体用法?PHP Chinese::convert怎么用?PHP Chinese::convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chinese
的用法示例。
在下文中一共展示了Chinese::convert方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _iconv
function _iconv($s, $t, $data)
{
if (function_exists('iconv')) {
return iconv($s, $t, $data);
} else {
require_once 'chinese.class.php';
$chs = new Chinese($s, $t);
return $chs->convert($data);
}
}
示例2: insenz_convert
function insenz_convert($str, $type = 1)
{
global $charset, $discuz_chs, $insenz_chs;
if ($charset != 'utf-8') {
require_once DISCUZ_ROOT . './include/chinese.class.php';
if ($type) {
if (!$insenz_chs) {
$insenz_chs = new Chinese($charset, 'utf-8', TRUE);
}
$str = $insenz_chs->convert($str);
} else {
if (!$discuz_chs) {
$discuz_chs = new Chinese('utf-8', $charset, TRUE);
}
$str = $discuz_chs->convert($str);
}
}
return $type ? htmlspecialchars($str) : addslashes($str);
}
示例3: libfile
require_once libfile('class/chinese');
$chs = new Chinese('utf-8', CHARSET);
}
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $index);
xml_parser_free($parser);
$xmldata = array('chanl', 'fid', 'title', 'tid', 'author', 'pdate', 'rdate', 'rnum', 'vnum', 'insite');
$relatedthreadlist = $keywords = array();
$nextuptime = 0;
foreach ($index as $tag => $valuearray) {
if (in_array($tag, $xmldata)) {
foreach ($valuearray as $key => $value) {
if ($values[$index['title'][$key]]['value']) {
$relatedthreadlist[$key][$tag] = !empty($chs) ? $chs->convert(trim($values[$value]['value'])) : trim($values[$value]['value']);
$relatedthreadlist[$key]['fid'] = !$values[$index['fid'][$key]]['value'] ? preg_replace("/(.+?)\\/forum\\-(\\d+)\\-(\\d+)\\.html/", "\\2", trim($values[$index['curl'][$key]]['value'])) : trim($values[$index['fid'][$key]]['value']);
$relatedthreadlist[$key]['tid'] = !$values[$index['tid'][$key]]['value'] ? preg_replace("/(.+?)\\/thread\\-(\\d+)\\-(\\d+)-(\\d+)\\.html/", "\\2", trim($values[$index['surl'][$key]]['value'])) : trim($values[$index['tid'][$key]]['value']);
}
}
} elseif (in_array($tag, array('kw', 'ekw'))) {
$type = $tag == 'kw' ? 'general' : 'trade';
foreach ($valuearray as $value) {
$keywords[$type][] = !empty($chs) ? $chs->convert(trim($values[$value]['value'])) : trim($values[$value]['value']);
}
} elseif ($tag == 'nextuptime') {
$nextuptime = $values[$index['nextuptime'][0]]['value'];
} elseif ($tag == 'keep' && intval($values[$index['keep'][0]]['value'])) {
exit;
}
}
示例4: gbToUTF8
/**
* GBK字符串转utf8为字符串
* @param string $str 要转换的字符串
* @return void
*/
function gbToUTF8($str)
{
static $chinese = NULL;
if ($chinese === NULL) {
require_once fimport('class/chinese');
$chinese = new Chinese('GBK', 'UTF-8');
}
return $chinese->convert($str);
}
示例5: rawurlencode
$messageenc = rawurlencode(strip_tags(preg_replace("/\\[.+?\\]/U", '', $message)));
$data = @implode('', file("http://keyword.discuz.com/related_kw.html?ics=" . CHARSET . "&ocs=" . CHARSET . "&title={$subjectenc}&content={$messageenc}"));
if ($data) {
if (PHP_VERSION > '5' && CHARSET != 'utf-8') {
require_once libfile('class/chinese');
$chs = new Chinese('utf-8', CHARSET);
}
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $index);
xml_parser_free($parser);
$kws = array();
foreach ($values as $valuearray) {
if ($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') {
$kws[] = !empty($chs) ? $chs->convert(trim($valuearray['value'])) : trim($valuearray['value']);
}
}
$return = '';
if ($kws) {
foreach ($kws as $kw) {
$kw = dhtmlspecialchars($kw);
$return .= $kw . ',';
}
$return = dhtmlspecialchars($return);
}
$return = substr($return, 0, strlen($return) - 1);
if (!$tid) {
$_G['inajax'] = 1;
include template('forum/relatekw');
} elseif ($kws) {
示例6: dz_get_tag
function dz_get_tag($subject, $message, $return_array = 0)
{
if (VIP) {
return FALSE;
}
if (empty($subject) && empty($message)) {
return FALSE;
}
$subjectenc = rawurlencode(strip_tags($subject));
$message = strip_tags(preg_replace("/\\[.+?\\]/U", '', $message));
$message = cutstr($message, 960, '');
$messageenc = rawurlencode($message);
$data = @implode('', file("http://keyword.discuz.com/related_kw.html?ics=" . CHARSET . "&ocs=" . CHARSET . "&title={$subjectenc}&content={$messageenc}"));
if (!$data) {
return FALSE;
}
if (PHP_VERSION > '5' && CHARSET != 'utf-8') {
require_once libfile('class/chinese');
$chs = new Chinese('utf-8', CHARSET);
}
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $index);
xml_parser_free($parser);
$kws = array();
foreach ($values as $valuearray) {
if ($valuearray['tag'] == 'kw' || $valuearray['tag'] == 'ekw') {
$kws[] = !empty($chs) ? $chs->convert(trim($valuearray['value'])) : trim($valuearray['value']);
}
}
if ($return_array) {
return $kws;
}
$return = '';
if ($kws) {
foreach ($kws as $kw) {
$kw = htmlspecialchars($kw);
$return .= $kw . ' ';
}
$return = htmlspecialchars($return);
}
return $return;
}