diff options
author | Wojciech Polak <polak@gnu.org> | 2004-11-14 12:26:13 +0000 |
---|---|---|
committer | Wojciech Polak <polak@gnu.org> | 2004-11-14 12:26:13 +0000 |
commit | 6babd80d1d04ae32aec09e1523db3531cddda548 (patch) | |
tree | abc2c23657e61ff1971e756a5c47c58f2afd3ffc | |
parent | 228298be889b5b9e5cd981fff1bb1fa3df54521d (diff) | |
download | blogright-6babd80d1d04ae32aec09e1523db3531cddda548.tar.gz blogright-6babd80d1d04ae32aec09e1523db3531cddda548.tar.bz2 |
Added htmlentities2(). Bump to 1.4
-rw-r--r-- | index.php | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,6 +1,6 @@ <?php -// blogRight! version 1.3 +// blogRight! version 1.4 // Copyright (C) 2004 Wojciech Polak. // // This program is free software; you can redistribute it and/or modify @@ -458,7 +458,7 @@ function indent_include ($level, $file) { for ($i = 0; $i < $level; $i++) print ' '; - print (htmlentities ($line)); + print (htmlentities2 ($line)); } } @@ -466,6 +466,14 @@ function indent_include ($level, $file) } } +function htmlentities2 ($htmlcode) +{ + $table = get_html_translation_table (HTML_ENTITIES, ENT_QUOTES); + $table[chr(38)] = '&'; + return preg_replace ("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&", + strtr ($htmlcode, $table)); +} + function microtime_diff ($a, $b) { list ($a_dec, $a_sec) = explode (' ', $a); |