Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;...

@version 1.0

Paramètres

string $property:

string $value:

Return value

array

Voir aussi

merge_4value_shorthands()

1 call to csstidy_optimise::dissolve_4value_shorthands()
csstidy_optimise::shorthands dans advagg_css_compress/csstidy/class.csstidy_optimise.inc
Optimises shorthands @access public @version 1.0

Fichier

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

Classe

csstidy_optimise
CSS Optimising Class

Code

function dissolve_4value_shorthands($property, $value) {
    $shorthands =& $GLOBALS['csstidy']['shorthands'];
    if (!is_array($shorthands[$property])) {
        $return[$property] = $value;
        return $return;
    }
    $important = '';
    if (csstidy::is_important($value)) {
        $value = csstidy::gvw_important($value);
        $important = '!important';
    }
    $values = explode(' ', $value);
    $return = array();
    if (count($values) == 4) {
        for ($i = 0; $i < 4; $i++) {
            $return[$shorthands[$property][$i]] = $values[$i] . $important;
        }
    }
    elseif (count($values) == 3) {
        $return[$shorthands[$property][0]] = $values[0] . $important;
        $return[$shorthands[$property][1]] = $values[1] . $important;
        $return[$shorthands[$property][3]] = $values[1] . $important;
        $return[$shorthands[$property][2]] = $values[2] . $important;
    }
    elseif (count($values) == 2) {
        for ($i = 0; $i < 4; $i++) {
            $return[$shorthands[$property][$i]] = $i % 2 != 0 ? $values[1] . $important : $values[0] . $important;
        }
    }
    else {
        for ($i = 0; $i < 4; $i++) {
            $return[$shorthands[$property][$i]] = $values[0] . $important;
        }
    }
    return $return;
}