mirror of
https://github.com/friendica/friendica
synced 2024-11-10 05:42:54 +00:00
use mb_ereg_replace for xmlify and unxmlify
This commit is contained in:
parent
18f71c1050
commit
c886927a52
1 changed files with 16 additions and 4 deletions
|
@ -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