Move htmlentities2 to functions-formatting.php. #2525

git-svn-id: https://develop.svn.wordpress.org/trunk@3717 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-04-19 03:03:27 +00:00
parent be2be64b99
commit 0d4e7d2db3
2 changed files with 9 additions and 8 deletions

View File

@@ -1032,4 +1032,12 @@ function clean_url( $url ) {
return $url;
}
// Borrowed from the PHP Manual user notes. Convert entities, while
// preserving already-encoded entities:
function htmlentities2($myHTML) {
$translation_table=get_html_translation_table (HTML_ENTITIES,ENT_QUOTES);
$translation_table[chr(38)] = '&';
return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($myHTML, $translation_table));
}
?>