ideenmanagement/func_htmlclean.php
2023-03-09 11:22:13 +01:00

35 lines
1.5 KiB
PHP
Executable File

<?PHP
ignore_user_abort(true); // DAMIT DAS SCRIPT AUF KEINEN TIMEOUT LÄUFT
@set_time_limit(0);
function htmlclean($html) {
global $db;
$html= preg_replace('/<(\/)?(font|del|ins|style)[^>]*>/','',$html);
$html= preg_replace('/<([^>]*)(class|lang|size|face)=("[^\"]*"|\'[^\']*\'|[^>]+)([^>]*)>/','',$html);
$html= preg_replace('/<([^>]*)(class|lang|size|face)=("[^\"]*"|\'[^\']*\'|[^>]+)([^>]*)>/','',$html);
$html= preg_replace('/<meta(.|\s)*?>/', '', $html);
$html= preg_replace('/<\/meta(.|\s)*?>/', '', $html);
$html= preg_replace('/<link(.|\s)*?>/', '', $html);
$html= preg_replace('/<!--.+?-->/s', '', $html);
$html= preg_replace('/\s{2,}/sm',' ',$html,PREG_SET_ORDER); //Mehr als zwei leerzeichen entfernen
$html= preg_replace('/\s{2,}/sm',' ',$html,PREG_SET_ORDER); //Mehr als zwei leerzeichen entfernen
$html= str_replace (array("\r\n"), array(""), $html);
/* Nächster Abschnitt neu ab 10.06.2011*/
$html = strip_tags($html, '<br>,<strong>,<ul>,<li>,<ol>');
$html = str_replace (array('"'), array("\""), $html);
$html = str_replace (array("'"), array("\""), $html);
$html = str_replace (array(" type='disc'"), array(""), $html);
$html = strip_tags($html, '<br>,<strong>,<ul>,<li>,<ol>');
$html = str_replace (array('"'), array("\""), $html);
$html = str_replace (array("'"), array("\""), $html);
$html = str_replace (array(" type='disc'"), array(""), $html);
$html= trim($html);
/* $html= mysqli_escape_string($db,stripslashes($html)); */
return $html;
}
?>