|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | /* |
4 | | -htmLawed 1.2.4.1, 12 September 2017 |
| 4 | +htmLawed 1.2.5, 24 September 2019 |
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 |
@@ -43,7 +43,7 @@ function htmLawed($t, $C=1, $S=array()){ |
43 | 43 | // config URLs |
44 | 44 | $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'; |
45 | 45 | $C['schemes'] = array(); |
46 | | -foreach(explode(';', str_replace(array(' ', "\t", "\r", "\n"), '', $x)) as $v){ |
| 46 | +foreach(explode(';', trim(str_replace(array(' ', "\t", "\r", "\n"), '', $x), ';')) as $v){ |
47 | 47 | $x = $x2 = null; list($x, $x2) = explode(':', $v, 2); |
48 | 48 | if($x2){$C['schemes'][$x] = array_flip(explode(',', $x2));} |
49 | 49 | } |
@@ -390,7 +390,7 @@ function hl_spec($t){ |
390 | 390 | if(!function_exists('hl_aux1')){function hl_aux1($m){ |
391 | 391 | return substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", '`"'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", '"'), $m[0]), 1, -1); |
392 | 392 | }} |
393 | | -$t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace_callback('/"(?>(`.|[^"])*)"/sm', 'hl_aux1', trim($t))); |
| 393 | +$t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace_callback('/"(?>(`.|[^"])*)"/sm', 'hl_aux1', trim($t))); |
394 | 394 | for($i = count(($t = explode(';', $t))); --$i>=0;){ |
395 | 395 | $w = $t[$i]; |
396 | 396 | if(empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))){continue;} |
@@ -652,11 +652,11 @@ function hl_tag2(&$e, &$a, $t=1){ |
652 | 652 | $a2 = ''; |
653 | 653 | while(preg_match('`(^|\s)(color|size)\s*=\s*(\'|")?(.+?)(\\3|\s|$)`i', $a, $m)){ |
654 | 654 | $a = str_replace($m[0], ' ', $a); |
655 | | - $a2 .= strtolower($m[2]) == 'color' ? (' color: '. str_replace('"', '\'', trim($m[4])). ';') : (isset($fs[($m = trim($m[4]))]) ? ($a2 .= ' font-size: '. str_replace('"', '\'', $fs[$m]). ';') : ''); |
| 655 | + $a2 .= strtolower($m[2]) == 'color' ? (' color: '. str_replace(array('"', ';', ':'), '\'', trim($m[4])). ';') : (isset($fs[($m = trim($m[4]))]) ? (' font-size: '. $fs[$m]. ';') : ''); |
656 | 656 | } |
657 | 657 | while(preg_match('`(^|\s)face\s*=\s*(\'|")?([^=]+?)\\2`i', $a, $m) or preg_match('`(^|\s)face\s*=(\s*)(\S+)`i', $a, $m)){ |
658 | 658 | $a = str_replace($m[0], ' ', $a); |
659 | | - $a2 .= ' font-family: '. str_replace('"', '\'', trim($m[3])). ';'; |
| 659 | + $a2 .= ' font-family: '. str_replace(array('"', ';', ':'), '\'', trim($m[3])). ';'; |
660 | 660 | } |
661 | 661 | $e = 'span'; return ltrim(str_replace('<', '', $a2)); |
662 | 662 | } |
@@ -725,5 +725,5 @@ function hl_tidy($t, $w, $p){ |
725 | 725 |
|
726 | 726 | function hl_version(){ |
727 | 727 | // version |
728 | | -return '1.2.4.1'; |
| 728 | +return '1.2.5'; |
729 | 729 | } |
0 commit comments