removeTags

Availability: >= 3.0

Type: Object Method

Description: If users paste in malicious scripts, ActiveX controls or other unwanted HTML elements this function allows you to strip them out.

Syntax:

string $html wproUtilities::removeTagsstring $html_code, array $tags );

Parameters:

$html
The function returns the HTML code with tags removed.

$html_code:  
The code sent from the form post that you want to process.
 
$tags: 
An array where the key in each row is the tag you want removed and the value is a true false parameter that indicates whether to just remove the tag, leaving the contents of the tag intact, or to remove the tag and all code contained within the tag. True indicates that the tag and its contents should be removed, false will only remove the tag itself.
 
You can use this function to remove any HTML tags that you do not want used.

Example:

In the following example $code holds the code sent from the form post and the following tags will be removed: object, embed, applet and script.

$code wproUtilities::removeTags ($code, array(
     
'object' => true,
     
'embed' => true,
     
'applet' => true,
     
'script' => true,
));