From b21b4f2ec2007fd8c4f0bdcdbe491f3e7b257e85 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Thu, 29 Dec 2022 12:40:35 +0100 Subject: [PATCH] Improved strip function --- web/site/instances.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/web/site/instances.php b/web/site/instances.php index 89efcb2..ae4c940 100644 --- a/web/site/instances.php +++ b/web/site/instances.php @@ -1,5 +1,7 @@ #',$str)===1) $str=preg_replace('#^\s*#','',$str); - while (preg_match('#\s*$#',$str)===1) $str=preg_replace('#\s*$#','',$str); - while (preg_match('#\s*#s',$str)===1) - $str=preg_replace('#\s*#s','
',$str); - $str=preg_replace('#]*)?>.*#s','',$str); - $str=preg_replace('#',$str); + $str=preg_replace('##i','

',$str); + $str=preg_replace(['#


#i','#
#i','#
#i','#

    #i'],['

    ','','
','
|)#i','$1'.N,$str); + $str=preg_replace(['#]*>(.*)

$#i', '#]*>(.*)$#i', '#]*>(.*)$#i', '#]*>(.*)$#i'],['

$1

', '
    $1
', '
    $1
', '
$1
'],$str); return($str); } @@ -584,7 +589,7 @@ while ($if<$il && $row=mysqli_fetch_assoc($res)) { if (mysqli_num_rows($rres)>0) { $out.='
    '.N; while ($rrow=mysqli_fetch_assoc($rres)) - $out.='
  1. '.hspech($rrow['Text']).'
  2. '.N; + $out.='
  3. '.hspech($rrow['Text']).'
  4. '.N;// no strip, do hspech, because it doesn’t support html nor markdown in mastodon $out.='
'.N; } else { $out.=''._('Not available{plural}').''; @@ -598,7 +603,7 @@ while ($if<$il && $row=mysqli_fetch_assoc($res)) { $out.='
    '.N; while ($rrow=mysqli_fetch_assoc($rres)) { $out.='
  • '.hspech($rrow['Domain']).': '.$sevmap[$rrow['Severity']]; - if (!is_null($rrow['Comment'])) $out.=' - '.hspech($rrow['Comment']); + if (!is_null($rrow['Comment'])) $out.=' - '.hspech($rrow['Comment']);// no strip, do hspech, because it doesn’t support html nor markdown in mastodon $out.='
  • '.N; } $out.='
'.N;