Update string.utl.php
This commit is contained in:
parent
57285afc42
commit
8c60df4494
|
@ -29,16 +29,21 @@ if(!check_function_exists("get_converted_string")) {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
if($form_charset == "detect") {
|
if($form_charset == "detect") {
|
||||||
if(!check_function_exists("mb_detect_encoding") && !check_function_exists("mb_detect_order")) {
|
$fn = check_invalid_function(array(
|
||||||
|
"NO_FUNCTION_MB_DETECT_ENCODING" => "mb_detect_encoding",
|
||||||
|
"NO_FUNCTION_MB_DETECT_ORDER" => "mb_detect_order",
|
||||||
|
));
|
||||||
|
|
||||||
|
if($fn == -1) {
|
||||||
$from_charset = mb_detect_encoding($str, mb_detect_order(), true);
|
$from_charset = mb_detect_encoding($str, mb_detect_order(), true);
|
||||||
} else {
|
} else {
|
||||||
$from_charset = "ISO-8859-1";
|
$from_charset = "ISO-8859-1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_function_exists("iconv")) {
|
if(check_function_exists("iconv")) {
|
||||||
$result = iconv($from_charset, $to_charset, $str);
|
$result = iconv($from_charset, $to_charset, $str);
|
||||||
} elseif(!check_function_exists("mb_convert_encoding")) {
|
} elseif(check_function_exists("mb_convert_encoding")) {
|
||||||
$result = mb_convert_encoding($str, $to_charset, $from_charset);
|
$result = mb_convert_encoding($str, $to_charset, $from_charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,9 +85,9 @@ if(!check_function_exists("get_cutted_string")) {
|
||||||
function get_cutted_string($str, $start, $len=0, $charset="utf-8") {
|
function get_cutted_string($str, $start, $len=0, $charset="utf-8") {
|
||||||
$result = "";
|
$result = "";
|
||||||
|
|
||||||
if(!check_function_exists("iconv_substr")) {
|
if(check_function_exists("iconv_substr")) {
|
||||||
$result = iconv_substr($str, $start, $len, $charset);
|
$result = iconv_substr($str, $start, $len, $charset);
|
||||||
} elseif(!check_function_exists("mb_substr")) {
|
} elseif(check_function_exists("mb_substr")) {
|
||||||
$result = mb_substr($str, $start, $len, $charset);
|
$result = mb_substr($str, $start, $len, $charset);
|
||||||
} else {
|
} else {
|
||||||
$result = substr($str, $start, $len);
|
$result = substr($str, $start, $len);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user