diff options
Diffstat (limited to 'inc/html.php')
-rw-r--r-- | inc/html.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/inc/html.php b/inc/html.php index a2a726406..03e9dc751 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1240,20 +1240,20 @@ function html_diff($text='',$intro=true,$type=null){ } function html_insert_softbreaks($diffhtml) { - // search the diff html string for both: - // - html tags, so these can be ignored - // - long strings of characters without breaking characters - return preg_replace_callback('/<[^>]*>|[^<> ]{12,}/','html_softbreak_callback',$diffhtml); + // search the diff html string for both: + // - html tags, so these can be ignored + // - long strings of characters without breaking characters + return preg_replace_callback('/<[^>]*>|[^<> ]{12,}/','html_softbreak_callback',$diffhtml); } function html_softbreak_callback($match){ - // if match is an html tag, return it intact - if ($match[0]{0} == '<') return $match[0]; + // if match is an html tag, return it intact + if ($match[0]{0} == '<') return $match[0]; - // its a long string without a breaking character, - // make certain characters into breaking characters by inserting a - // breaking character (zero length space, U+200B / #8203) in front them. - $regex = <<< REGEX + // its a long string without a breaking character, + // make certain characters into breaking characters by inserting a + // breaking character (zero length space, U+200B / #8203) in front them. + $regex = <<< REGEX (?(?= # start a conditional expression with a positive look ahead ... &\#?\\w{1,6};) # ... for html entities - we don't want to split them (ok to catch some invalid combinations) &\#?\\w{1,6}; # yes pattern - a quicker match for the html entity, since we know we have one @@ -1262,7 +1262,7 @@ function html_softbreak_callback($match){ )+ # end conditional expression REGEX; - return preg_replace('<'.$regex.'>xu','\0​',$match[0]); + return preg_replace('<'.$regex.'>xu','\0​',$match[0]); } /** |