public function CSSCompression_Combine_Font::combine in Advanced CSS/JS Aggregation 6
Same name and namespace in other branches
- 7 advagg_css_compress/css-compressor-3.x/src/lib/Combine/Font.inc \CSSCompression_Combine_Font::combine()
Combines multiple font-definitions into single definition
Parameters
(string) val: Rule Set:
File
- advagg_css_compress/
css-compressor-3.x/ src/ lib/ Combine/ Font.inc, line 55
Class
- CSSCompression_Combine_Font
- CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com
Code
public function combine($val) {
$storage = $this
->storage($val);
// Loop through each property check and see if they can be replaced
foreach ($this->groupings as $props) {
if ($replace = $this->Combine
->searchDefinitions('font', $storage, $props)) {
break;
}
}
// If replacement string found, run it on all declarations
if ($replace) {
$pos = 0;
while (preg_match($this->rfont, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
if (!isset($storage['line-height']) && stripos($match[0][0], 'line-height') === 0) {
$pos = $match[0][1] + strlen($match[0][0]) - 1;
continue;
}
$colon = strlen($match[1][0]);
$val = substr_replace($val, $replace, $match[0][1] + $colon, strlen($match[0][0]) - $colon);
$pos = $match[0][1] + strlen($replace) - $colon - 1;
$replace = '';
}
}
// Return converted val
return $val;
}