function validCleanHtml( $unclosedString )
{
preg_match_all( "/<([^\/]\w*)>/", $closedString = $unclosedString, $tags );
for ( $i = count( $tags[1] ) - 1; $i >= 0; $i-- )
{
$tag = $tags[1][$i];
if ( substr_count( $closedString, "</$tag>" ) < substr_count( $closedString, "<$tag>" ) )
$closedString .= "</$tag>";
}
$validTags = "<em><strong>";
$validClosedString = strip_tags( $closedString, $validTags );
return $validClosedString;
}
хорошо, я хочу включить 2 html, em и strong, это просто безопасно от xss? если нет, то как мы можем это обезопасить?