Skip to content

Commit

Permalink
Merge pull request #2 from fossar/fix/srcset-value
Browse files Browse the repository at this point in the history
Fix srcset handling
  • Loading branch information
j0k3r authored Dec 14, 2018
2 parents f7a324a + b7eba15 commit f83914c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion htmLawed.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,10 @@ function hl_tag($t){
$v = str_replace("­", ' ', (strpos($v, '&') !== false ? str_replace(array('­', '­', '­'), ' ', $v) : $v)); # double-quoted char: soft-hyphen; appears here as "­" or hyphen or something else depending on viewing software
if($k == 'srcset'){
$v2 = '';
foreach(explode(',', $v) as $k1=>$v1){
$pattern = "/(?:[^\"'\s]+\s*(?:\d+[wx])+)/";
preg_match_all($pattern, $v, $matches);
$matches = call_user_func_array('array_merge', $matches);
foreach($matches as $k1=>$v1){
$v1 = explode(' ', ltrim($v1), 2);
$k1 = isset($v1[1]) ? trim($v1[1]) : '';
$v1 = trim($v1[0]);
Expand Down

0 comments on commit f83914c

Please sign in to comment.