use mb_ereg_replace for xmlify and unxmlify
This commit is contained in:
parent
18f71c1050
commit
c886927a52
|
@ -173,7 +173,7 @@ function autoname($len) {
|
|||
|
||||
if(! function_exists('xmlify')) {
|
||||
function xmlify($str) {
|
||||
$buffer = '';
|
||||
/* $buffer = '';
|
||||
|
||||
$len = mb_strlen($str);
|
||||
for($x = 0; $x < $len; $x ++) {
|
||||
|
@ -205,7 +205,14 @@ function xmlify($str) {
|
|||
$buffer .= $char;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
$buffer = mb_ereg_replace("&", "&", $str);
|
||||
$buffer = mb_ereg_replace("'", "'", $buffer);
|
||||
$buffer = mb_ereg_replace("\"", """, $buffer);
|
||||
$buffer = mb_ereg_replace("<", "<", $buffer);
|
||||
$buffer = mb_ereg_replace(">", ">", $buffer);
|
||||
|
||||
$buffer = trim($buffer);
|
||||
return($buffer);
|
||||
}}
|
||||
|
@ -215,8 +222,13 @@ function xmlify($str) {
|
|||
|
||||
if(! function_exists('unxmlify')) {
|
||||
function unxmlify($s) {
|
||||
$ret = str_replace('&','&', $s);
|
||||
$ret = str_replace(array('<','>','"','''),array('<','>','"',"'"),$ret);
|
||||
// $ret = str_replace('&','&', $s);
|
||||
// $ret = str_replace(array('<','>','"','''),array('<','>','"',"'"),$ret);
|
||||
$ret = mb_ereg_replace('&', '&', $s);
|
||||
$ret = mb_ereg_replace(''', "'", $ret);
|
||||
$ret = mb_ereg_replace('"', '"', $ret);
|
||||
$ret = mb_ereg_replace('<', "<", $ret);
|
||||
$ret = mb_ereg_replace('>', ">", $ret);
|
||||
return $ret;
|
||||
}}
|
||||
|
||||
|
|
Loading…
Reference in a new issue