private function CSSCompression_Combine_BorderOutline::storage in Advanced CSS/JS Aggregation 6
Same name and namespace in other branches
- 7 advagg_css_compress/css-compressor-3.x/src/lib/Combine/BorderOutline.inc \CSSCompression_Combine_BorderOutline::storage()
Builds a storage object for iteration
Parameters
(string) val: Rule Set:
1 call to CSSCompression_Combine_BorderOutline::storage()
- CSSCompression_Combine_BorderOutline::combine in advagg_css_compress/
css-compressor-3.x/ src/ lib/ Combine/ BorderOutline.inc - Combines color/style/width of border/outline properties
File
- advagg_css_compress/
css-compressor-3.x/ src/ lib/ Combine/ BorderOutline.inc, line 63
Class
- CSSCompression_Combine_BorderOutline
- CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com
Code
private function storage($val) {
$storage = array();
$pos = 0;
// Find all possible occurences and build the replacement
while (preg_match($this->rcsw, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
if (!isset($storage[$match[2][0]])) {
$storage[$match[2][0]] = array(
$match[3][0] => $match[4][0],
);
}
// Override double written properties
$storage[$match[2][0]][$match[3][0]] = $match[4][0];
$pos = $match[0][1] + strlen($match[0][0]) - 1;
}
// Go through each tag for possible combination
foreach ($storage as $tag => $arr) {
// All three have to be defined
if (count($arr) == 3 && !$this->Combine
->checkUncombinables($arr)) {
$storage[$tag] = "{$tag}:" . $arr['width'] . ' ' . $arr['style'] . ' ' . $arr['color'] . ';';
}
else {
unset($storage[$tag]);
}
}
return $storage;
}