예제 #1
0
function text_xmlentities($str)
{
    return htmlspecialchars(xmlfilterevilchars($str), ENT_NOQUOTES, 'UTF-8');
}
예제 #2
0
function xmlentities($str)
{
    $from[0] = '&';
    $to[0] = '&';
    $from[1] = '<';
    $to[1] = '&lt;';
    $from[2] = '>';
    $to[2] = '&gt;';
    $from[3] = '"';
    $to[3] = '&quot;';
    $from[4] = '\'';
    $to[4] = '&apos;';
    for ($i = 0; $i <= 4; $i++) {
        $str = mb_ereg_replace($from[$i], $to[$i], $str);
    }
    return xmlfilterevilchars($str);
}