From c1f0e8779e2ecd7b60631c115b39e8dcbe13ecb9 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Sun, 25 Aug 2024 19:55:58 +0200 Subject: [PATCH] =?UTF-8?q?Refined=20=E2=80=9Cstrip=E2=80=9D=20function=20?= =?UTF-8?q?a=20bit=20again=20(added=20some=20regex,=20modified=20a=20bit?= =?UTF-8?q?=20some=20others)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/site/instances.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/site/instances.php b/web/site/instances.php index 647dc15..8a4f5ae 100644 --- a/web/site/instances.php +++ b/web/site/instances.php @@ -965,21 +965,21 @@ function nullyp($str) { function strip($str,$uri) { if (nullemp($str)) return(null); - //echo '
'.htmlentities($str).'
'; + //echo '
'.$str.'
'; $str=preg_replace(['#^\s*#m','#[\r\n]#'],['',' '],$str);// strip all spaces from empty lines, then all carriage return and new line chars - $str=preg_replace('##i','
',$str);// convert all "
" to "
" + $str=preg_replace('##i','
',$str);// convert all "
" to "
" $str=preg_replace('#]*>#i','',$str); $str=preg_replace('#]*href="(?![a-zA-Z]+://)([^"]+)#i',']*)>#i','<$1$3>',$str); $str=preg_replace(['#]*>#i','##i'],['

','

'],$str); $str=preg_replace(['#<([ou])l[^>]*>#i','##i'],['

<$1l class="nobott">','

'],$str); - $str=preg_replace(['#
\s+
#i','#^(
)+#i','#(
){3,}#i','#(
)+$#i','#\s*(
)+#i','#\s*(
)+#i'],['

','','

','','
','
'],$str); + $str=preg_replace(['#\s+$#','#
\s+
#i','#^(
)+#i','#(
){3,}#i','#(
)+$#i','#\s*(
)+#i','#\s*(
)+#i'],['','

','','

','','
','
'],$str); // this part below is to try and assign the css "nobott" css class to a possible closing
    /
      , to avoid the useless and UGLY last bottom-margin :-) $str=preg_replace(['#]*>(.*)
$#i','#]*>(.*)$#i'],['
    $1
','
    $1
'],$str); return $str;