You are here

private function CSSCompression_Combine_Font::storage in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg_css_compress/css-compressor-3.x/src/lib/Combine/Font.inc \CSSCompression_Combine_Font::storage()

Builds a storage object for iteration

Parameters

(string) val: Rule Set:

1 call to CSSCompression_Combine_Font::storage()
CSSCompression_Combine_Font::combine in advagg_css_compress/css-compressor-3.x/src/lib/Combine/Font.inc
Combines multiple font-definitions into single definition

File

advagg_css_compress/css-compressor-3.x/src/lib/Combine/Font.inc, line 89

Class

CSSCompression_Combine_Font
CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com

Code

private function storage($val) {
  $storage = array();

  // Find all possible occurences and build the replacement
  $pos = 0;
  while (preg_match($this->rfont, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
    $storage[$match[2][0] . '-' . $match[3][0]] = $match[4][0];
    $pos = $match[0][1] + strlen($match[0][0]) - 1;
  }

  // Combine font-size & line-height if possible
  if (isset($storage['font-size']) && isset($storage['line-height'])) {
    $storage['size/height'] = $storage['font-size'] . '/' . $storage['line-height'];
    unset($storage['font-size'], $storage['line-height']);
  }
  return $storage;
}