Add function dolEscapeXML
This commit is contained in:
parent
c73f4a14ee
commit
756b1d31ad
@ -427,6 +427,18 @@ function dol_string_nospecial($str,$newstr='_',$badchars='')
|
|||||||
return str_replace($forbidden_chars_to_replace,$newstr,str_replace($forbidden_chars_to_remove,"",$str));
|
return str_replace($forbidden_chars_to_replace,$newstr,str_replace($forbidden_chars_to_remove,"",$str));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode string for xml usage
|
||||||
|
*
|
||||||
|
* @param string $string String to encode
|
||||||
|
* @return string String encoded
|
||||||
|
*/
|
||||||
|
function dolEscapeXML($string)
|
||||||
|
{
|
||||||
|
return strtr($string, array('\''=>''','"'=>'"','&'=>'&','<'=>'<','>'=>'>'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns text escaped for inclusion into javascript code
|
* Returns text escaped for inclusion into javascript code
|
||||||
*
|
*
|
||||||
@ -3468,6 +3480,7 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called to encode a string into a HTML string but differs from htmlentities because
|
* This function is called to encode a string into a HTML string but differs from htmlentities because
|
||||||
* all entities but &,<,> are converted. This permits to encode special chars to entities with no double
|
* all entities but &,<,> are converted. This permits to encode special chars to entities with no double
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user