Merges Shorthand properties again, the opposite of dissolve_4value_shorthands()

@version 1.2

Paramètres

array $array:

Return value

array

Voir aussi

dissolve_4value_shorthands()

1 call to csstidy_optimise::merge_4value_shorthands()
csstidy_optimise::postparse dans advagg_css_compress/csstidy/class.csstidy_optimise.inc
Optimises $css after parsing @access public @version 1.0

Fichier

advagg_css_compress/csstidy/class.csstidy_optimise.inc, line 626

Classe

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;
}