Enhanced a bit strip function

This commit is contained in:
pezcurrel 2022-12-29 21:42:44 +01:00
parent 3db59734d1
commit cae51fc141

View file

@ -207,9 +207,9 @@ function strip($str,$uri) {
$str=preg_replace('#<a href="(?![a-zA-Z]+://)([^"]+)#i','<a href="https://'.$uri.'$1>',$str);
$str=preg_replace(['#<h[1-9][^>]*>#i','#</h[1-9]>#i'],['<p class="exh">','</p>'],$str);
$str=preg_replace(['#</p><br>#i','#</li><br>#i','#</ul><br>#i','#<ul><br>#i'],['</p>','</li>','</ul>','<ul>'],$str);
$str=preg_replace(['#<b>#i','#</b>#i'],['<strong>','</strong>'],$str);
$str=preg_replace(['#<b>#i','#</b>#i','#<i>#i','#</i>#i'],['<strong>','</strong>','<em>','</em>'],$str);
$str=preg_replace('#<p>\s*</p>#is','',$str);
$str=strip_tags($str,'<a><br><ol><ul><li><p><div><i><b><strong><em><small><img>');
$str=strip_tags($str,'<a><br><ol><ul><li><p><div><strong><em><small><img>');
$str=preg_replace('#^\s*#m','',$str);
$str=preg_replace('#[\r\n]#',' ',$str);
$str=preg_replace('#(</p>|</ol>|</ul>|</div>)#i','$1'.N,$str);