function advagg_get_bundle_from_filename in Advanced CSS/JS Aggregation 6        
                          
                  
                        Same name and namespace in other branches
- 7 advagg.module \advagg_get_bundle_from_filename()
2 calls to advagg_get_bundle_from_filename()
  - advagg_bundle_built in ./advagg.module
- See if this bundle has been built.
- advagg_missing_regenerate in ./advagg.missing.inc
- regenerates a missing css file.
File
 
   - ./advagg.module, line 1561
- Advanced CSS/JS aggregation module
Code
function advagg_get_bundle_from_filename($filename) {
  
  if (!preg_match('/^(j|cs)s_[0-9a-f]{32}_\\d+\\.(j|cs)s$/', $filename)) {
    return t('Wrong Pattern.');
  }
  
  $type = substr($filename, 0, strpos($filename, '_'));
  
  $ext = substr($filename, strpos($filename, '.', 37) + 1);
  
  if ($ext != $type) {
    return t('Type does not match extension.');
  }
  
  if ($type == 'css') {
    $md5 = substr($filename, 4, 32);
    $counter = substr($filename, 37, strpos($filename, '.', 38) - 37);
  }
  elseif ($type == 'js') {
    $md5 = substr($filename, 3, 32);
    $counter = substr($filename, 36, strpos($filename, '.', 37) - 36);
  }
  else {
    return t('Wrong file type.');
  }
  return array(
    $type,
    $md5,
    $counter,
  );
}