Finds directional compression on methods like margin/padding
Paramètres
(string) val: Value of CSS Property:
2 calls to CSSCompression_Individuals::directionals()
- CSSCompression_Individuals::borderRadius dans advagg_css_compress/
css-compressor-3.x/ src/ lib/ Individuals.inc - Preps border radius for directional compression
- CSSCompression_Individuals::individuals dans advagg_css_compress/
css-compressor-3.x/ src/ lib/ Individuals.inc - Runs special unit/directional compressions
Fichier
-
advagg_css_compress/
css-compressor-3.x/ src/ lib/ Individuals.inc, line 158
Classe
- CSSCompression_Individuals
- CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com
Code
private function directionals($val) {
// Split up each definiton
$direction = preg_split($this->rspace, $val);
// 4 Direction reduction
$count = count($direction);
if ($count == 4) {
// All 4 sides are the same, combine into 1 definition
if ($direction[0] == $direction[1] && $direction[2] == $direction[3] && $direction[0] == $direction[3]) {
$direction = array(
$direction[0],
);
}
else {
if ($direction[0] == $direction[2] && $direction[1] == $direction[3]) {
$direction = array(
$direction[0],
$direction[1],
);
}
else {
if ($direction[1] == $direction[3]) {
$direction = array(
$direction[0],
$direction[1],
$direction[2],
);
}
}
}
}
else {
if ($count == 3) {
// All directions are the same
if ($direction[0] == $direction[1] && $direction[1] == $direction[2]) {
$direction = array(
$direction[0],
);
}
else {
if ($direction[0] == $direction[2]) {
$direction = array(
$direction[0],
$direction[1],
);
}
}
}
else {
if ($count == 2 && $direction[0] == $direction[1]) {
$direction = array(
$direction[0],
);
}
}
}
// Return the combined version of the directions
// Single entries will just return
return implode(' ', $direction);
}