|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | /* |
4 | | -htmLawed 1.2.4, 31 August 2017 |
| 4 | +htmLawed 1.2.4.1, 12 September 2017 |
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 |
@@ -387,10 +387,10 @@ function hl_regex($p){ |
387 | 387 | function hl_spec($t){ |
388 | 388 | // final $spec |
389 | 389 | $s = array(); |
390 | | -function hl_aux1($m){ |
| 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 | | -} |
393 | | -$t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace_callback('/"(?>(`.|[^"])*)"/sm', 'hl_aux1', trim($t))); |
| 392 | +}} |
| 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;} |
@@ -669,9 +669,9 @@ function hl_tag2(&$e, &$a, $t=1){ |
669 | 669 | function hl_tidy($t, $w, $p){ |
670 | 670 | // tidy/compact HTM |
671 | 671 | if(strpos(' pre,script,textarea', "$p,")){return $t;} |
672 | | -function hl_aux2($m){ |
| 672 | +if(!function_exists('hl_aux2')){function hl_aux2($m){ |
673 | 673 | return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", ' '), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4]; |
674 | | -} |
| 674 | +}} |
675 | 675 | $t = preg_replace(array('`(<\w[^>]*(?<!/)>)\s+`', '`\s+`', '`(<\w[^>]*(?<!/)>) `'), array(' $1', ' ', '$1'), preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea)[^>]*?>)(.+?)(</\2>)`sm'), 'hl_aux2', $t)); |
676 | 676 | if(($w = strtolower($w)) == -1){ |
677 | 677 | return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t); |
@@ -725,5 +725,5 @@ function hl_aux2($m){ |
725 | 725 |
|
726 | 726 | function hl_version(){ |
727 | 727 | // version |
728 | | -return '1.2.4'; |
| 728 | +return '1.2.4.1'; |
729 | 729 | } |
0 commit comments