function csstidy_optimise::merge_4value_shorthands in Advanced CSS/JS Aggregation 7
Same name and namespace in other branches
- 6 advagg_css_compress/csstidy/class.csstidy_optimise.inc \csstidy_optimise::merge_4value_shorthands()
Merges Shorthand properties again, the opposite of dissolve_4value_shorthands()
@version 1.2
Parameters
array $array:
Return value
array
See also
dissolve_4value_shorthands()
1 call to csstidy_optimise::merge_4value_shorthands()
- csstidy_optimise::postparse in advagg_css_compress/
csstidy/ class.csstidy_optimise.inc - Optimises $css after parsing @access public @version 1.0
File
- advagg_css_compress/
csstidy/ class.csstidy_optimise.inc, line 626
Class
- csstidy_optimise
- CSS Optimising Class
Code
function merge_4value_shorthands($array) {
$return = $array;
$shorthands =& $GLOBALS['csstidy']['shorthands'];
foreach ($shorthands as $key => $value) {
if (isset($array[$value[0]]) && isset($array[$value[1]]) && isset($array[$value[2]]) && isset($array[$value[3]]) && $value !== 0) {
$return[$key] = '';
$important = '';
for ($i = 0; $i < 4; $i++) {
$val = $array[$value[$i]];
if (csstidy::is_important($val)) {
$important = '!important';
$return[$key] .= csstidy::gvw_important($val) . ' ';
}
else {
$return[$key] .= $val . ' ';
}
unset($return[$value[$i]]);
}
$return[$key] = csstidy_optimise::shorthand(trim($return[$key] . $important));
}
}
return $return;
}