strip css
Posted: Wed Sep 21, 2005 3:30 am
Hmm.. is there a function for strippin css ? similar to strip_tags? or would I need to use a regex?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
strip_css() maybescrotaye wrote:Hmm.. is there a function for strippin css ? similar to strip_tags? or would I need to use a regex?
Code: Select all
<style type="text/css">
.class {
color: #000000;
}
</style>Code: Select all
$string = preg_replace("/<style type=(\"|')(.+)(\"|')>(.+)<\/style>/i", "<style type=\"$1\"></style>", $string);Code: Select all
<?
$tags =<<<END
<style type="text/css">
.class {
color: #000000;
}
</style>
[ Jean Claude Van Dame ]
<style type="text/css">
.class {
color: #000000;
}
</style>
END;
function strip_css($body)
{
return preg_replace('|<\w+[^>]>.*?</\w+[^>]>|is', 'Tags Replaced', $body);
}
print "Strip Tags: ".strip_tags($tags)."<br />";
print "My Strip Tags: ".strip_css($tags);
?>