filter

Stripping out script tags with PHP from multiline html text, feed, RSS, pages

Submitted by fabio on Mon, 2010-09-20 17:04.

If you need to strip out the tag script using PHP from a multiple line text (eg an html page, an RSS feed, an XML document) you can simply use the following PHP preg_replace instruction:

$content_filtered = preg_replace("/.*?<\/script>/xmsi", "", $content);

In the above code, $content contains your raw multiple line html and $content_filtered will contain the filtered version of $content.

Using that preg_replace instruction is demontrated in the attached php file.

Drupal: how to clear the filter cache

Submitted by fabio on Tue, 2008-07-15 16:10.

A filter is a Drupal feature, usually implemented by some contributed modules, which substitutes parts of a node text with some other text.

Eg: if you use the Path filter module you can insert links like:

<a href="internal:node/25">hello!</a>

and the string internal:node/25 will be substituted by something like http://www.example.com/node/25 where www.example.com is your website url.