|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | /* |
4 | | -htmLawed 1.2.4.2, 16 May 2019 |
| 4 | +htmLawed 1.2.6, 4 September 2021 |
5 | 5 | Copyright Santosh Patnaik |
6 | 6 | Dual licensed with LGPL 3 and GPL 2+ |
7 | 7 | A PHP Labware internal utility - www.bioinformatics.org/phplabware/internal_utilities/htmLawed |
@@ -46,8 +46,8 @@ function htmLawed($t, $C = 1, $S = []) |
46 | 46 | } |
47 | 47 | $C['elements'] = &$e; |
48 | 48 | // config attrs |
49 | | - $x = !empty($C['deny_attribute']) ? strtolower(str_replace(["\n", "\r", "\t", ' '], '', $C['deny_attribute'])) : ''; |
50 | | - $x = array_flip((isset($x[0]) && '*' === $x[0]) ? str_replace('/', 'data-', explode('-', str_replace('data-', '/', $x))) : explode(',', $x . (!empty($C['safe']) ? ',on*' : ''))); |
| 49 | + $x = !empty($C['deny_attribute']) ? strtolower(preg_replace('"\s+-"', '/', trim($C['deny_attribute']))) : ''; |
| 50 | + $x = array_flip((isset($x[0]) && '*' === $x[0]) ? explode('/', $x) : explode(',', $x . (!empty($C['safe']) ? ',on*' : ''))); |
51 | 51 | $C['deny_attribute'] = $x; |
52 | 52 | // config URLs |
53 | 53 | $x = (isset($C['schemes'][2]) && strpos($C['schemes'], ':')) ? strtolower($C['schemes']) : 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, tel, telnet' . (empty($C['safe']) ? ', app, javascript; *: data, javascript, ' : '; *:') . 'file, http, https'; |
@@ -1016,11 +1016,11 @@ function hl_tag2(&$e, &$a, $t = 1) |
1016 | 1016 | $a2 = ''; |
1017 | 1017 | while (preg_match('`(^|\s)(color|size)\s*=\s*(\'|")?(.+?)(\\3|\s|$)`i', $a, $m)) { |
1018 | 1018 | $a = str_replace($m[0], ' ', $a); |
1019 | | - $a2 .= 'color' === strtolower($m[2]) ? (' color: ' . str_replace('"', '\'', trim($m[4])) . ';') : (isset($fs[($m = trim($m[4]))]) ? ($a2 .= ' font-size: ' . str_replace('"', '\'', $fs[$m]) . ';') : ''); |
| 1019 | + $a2 .= 'color' === strtolower($m[2]) ? (' color: ' . str_replace(['"', ';', ':'], '\'', trim($m[4])) . ';') : (isset($fs[($m = trim($m[4]))]) ? (' font-size: ' . $fs[$m] . ';') : ''); |
1020 | 1020 | } |
1021 | 1021 | while (preg_match('`(^|\s)face\s*=\s*(\'|")?([^=]+?)\\2`i', $a, $m) || preg_match('`(^|\s)face\s*=(\s*)(\S+)`i', $a, $m)) { |
1022 | 1022 | $a = str_replace($m[0], ' ', $a); |
1023 | | - $a2 .= ' font-family: ' . str_replace('"', '\'', trim($m[3])) . ';'; |
| 1023 | + $a2 .= ' font-family: ' . str_replace(['"', ';', ':'], '\'', trim($m[3])) . ';'; |
1024 | 1024 | } |
1025 | 1025 | $e = 'span'; |
1026 | 1026 |
|
@@ -1130,5 +1130,5 @@ function hl_aux2($m) |
1130 | 1130 | function hl_version() |
1131 | 1131 | { |
1132 | 1132 | // version |
1133 | | - return '1.2.4.2'; |
| 1133 | + return '1.2.6'; |
1134 | 1134 | } |
0 commit comments