private function CSSCompression_Combine_Border::replace in Advanced CSS/JS Aggregation 6
Same name and namespace in other branches
- 7 advagg_css_compress/css-compressor-3.x/src/lib/Combine/Border.inc \CSSCompression_Combine_Border::replace()
Builds a replacement string
Parameters
(string) val: Rule Set:
1 call to CSSCompression_Combine_Border::replace()
- CSSCompression_Combine_Border::combine in advagg_css_compress/
css-compressor-3.x/ src/ lib/ Combine/ Border.inc - Combines multiple border properties into single definition
File
- advagg_css_compress/
css-compressor-3.x/ src/ lib/ Combine/ Border.inc, line 59
Class
- CSSCompression_Combine_Border
- CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com
Code
private function replace($val) {
$storage = array();
// Find all possible occurences and build the replacement
$pos = 0;
while (preg_match($this->rborder, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
// Override double written properties
$storage[$match[2][0]] = $match[3][0];
$pos = $match[0][1] + strlen($match[0][0]) - 1;
}
// All 4 have to be defined
if (count($storage) == 4 && $storage['top'] == $storage['bottom'] && $storage['left'] == $storage['right'] && $storage['top'] == $storage['right']) {
return "border:" . $storage['top'] . ';';
}
return false;
}