strip css
Moderator: General Moderators
strip css
Hmm.. is there a function for strippin css ? similar to strip_tags? or would I need to use a regex?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
Re: strip css
strip_css() maybescrotaye wrote:Hmm.. is there a function for strippin css ? similar to strip_tags? or would I need to use a regex?
strip_tags() will strip the tags
but not the information between the tags
running strip_tags() on that will output ".class { color: #000000; }"
edit: I probably should've clarified better
I would like to strip out the information between the <style </style> tags
Code: Select all
<style type="text/css">
.class {
color: #000000;
}
</style>edit: I probably should've clarified better
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
regex it then, if that is all 
Code: Select all
$string = preg_replace("/<style type=(\"|')(.+)(\"|')>(.+)<\/style>/i", "<style type=\"$1\"></style>", $string);- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
Home-made Cookies
edit: tooo late 
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);
?>