note 88491 modified in function.strip-tags by felipe

From: Date: Mon, 02 Feb 2009 20:58:32 +0000
Subject: note 88491 modified in function.strip-tags by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-150128@lists.php.net to get a copy of this message
Maybe also a usefull function for someone. <?php function removeUnsafeAttributesAndGivenTags($input, $validTags = '') { $regex = '#\s*<(/?\w+)\s+(?:on\w+\s*=\s*(["\'\s])?.+? \(\1?.+?\1?\);?\1?|style=["\'].+?["\'])\s*>#is'; return preg_replace($regex, '<${1}>',strip_tags($input, $validTags)); } ?> --was-- Maybe also a usefull function for someone. function removeUnsafeAttributesAndGivenTags($input, $validTags = '') { $regex = '#\s*<(/?\w+)\s+(?:on\w+\s*=\s*(["\'\s])?.+? \(\1?.+?\1?\);?\1?|style=["\'].+?["\'])\s*>#is'; return preg_replace($regex, '<${1}>',strip_tags($input, $validTags)); } http://php.net/manual/en/function.strip-tags.php

« previous php.notes (#150128) next »