function csstidy::css_new_media_section in Advanced CSS/JS Aggregation 6
Start a new media section. Check if the media is not already known, else rename it with extra spaces to avoid merging
Parameters
string $media:
Return value
string
1 call to csstidy::css_new_media_section()
- csstidy::parse in advagg_css_compress/
csstidy/ class.csstidy.inc - Parses CSS in $string. The code is saved as array in $this->css
File
- advagg_css_compress/
csstidy/ class.csstidy.inc, line 1008
Class
- csstidy
- CSS Parser class
Code
function css_new_media_section($media) {
if ($this
->get_cfg('preserve_css')) {
return $media;
}
// if the last @media is the same as this
// keep it
if (!$this->css or !is_array($this->css) or empty($this->css)) {
return $media;
}
end($this->css);
list($at, ) = each($this->css);
if ($at == $media) {
return $media;
}
while (isset($this->css[$media])) {
if (is_numeric($media)) {
$media++;
}
else {
$media .= " ";
}
}
return $media;
}