/** * Retrieve the CSS Manager, creates one if it doesn't exist * * @return sfCombineManager */ public static function getCssManager() { if (self::$_cssManager === null) { self::$_cssManager = new self(); } return self::$_cssManager; }
/** * @see get_combined_javascripts */ function get_combined_stylesheets($groups = null, $groupType = sfCombineManager::GROUP_INCLUDE, $onlyUnusedGroups = true, $markGroupsUsed = true) { // because of groups its better to run this through when sfCombine is disabled // but just set all files to do not combine $sfCombineEnabled = sfConfig::get('app_sfCombinePlugin_enabled', false); $manager = sfCombineManager::getCssManager(); sfConfig::set('symfony.asset.stylesheets_included', true); $response = sfContext::getInstance()->getResponse(); $config = sfConfig::get('app_sfCombinePlugin_css', array()); $doNotCombine = isset($config['combine_skip']) ? $config['combine_skip'] : array(); $manager->setSkips(array_merge($manager->getSkips(), $doNotCombine)); $groupedFiles = $manager->getAssetsByGroup($response->getStylesheets(), $sfCombineEnabled ? $config['combine'] : false, $groups, $groupType, $onlyUnusedGroups, $markGroupsUsed, array(new sfCombineCombinerCss(), 'getAssetPath')); $html = ''; $timestampConfig = sfConfig::get('app_sfCombinePlugin_timestamp', array()); foreach ($groupedFiles as $fileDetails) { if (!$fileDetails['combinable']) { $file = $fileDetails['files']; if (isset($timestampConfig['uncombinable']) && $timestampConfig['uncombinable'] && $fileDetails['timestamp']) { if (strpos($file, '?') !== false) { $file .= '&t=' . $fileDetails['timestamp']; } else { $file .= '?t=' . $fileDetails['timestamp']; } } $html .= stylesheet_tag($file, $fileDetails['options']); } else { $route = isset($config['route']) ? $config['route'] : 'sfCombine'; $html .= stylesheet_tag(url_for('@' . $route . '?module=sfCombine&action=css&' . sfCombineUrl::getUrlString($fileDetails['files'], $fileDetails['timestamp'])), $fileDetails['options']); } } return $html; }